-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better documentation #22
Comments
I would use example/explanation of form rendering as I can't manage it to work. Concretely how to access filteringForm from template. Would you please provide simple example of table with filtering? If you do not have time for documentation, you can put simple example here and I will prepare PR. Thanks! |
hello, here is one example: /**
*
* @author David Kudera <[email protected]>
*/
class BrowseList extends Control
{
/**
* @return \Carrooi\NoGrid\NoGrid
*/
protected function createComponentGrid()
{
$grid = $this->gridFactory->create(new DoctrineQueryFunctionDataSource(...));
$grid->setFilteringForm($this->createFilteringForm(), 'reset');
$grid->addFilter('name', Condition::LIKE, [
Condition::CASE_INSENSITIVE => true,
]/*, function($name) { // customize DQL parameter
return '%'. $name. '%';
}*/);
return $grid;
}
/**
* @return \Nette\Application\UI\Form
*/
private function createFilteringForm()
{
$form = new Form;
$form->addText('name');
$form->addSubmit('search', 'Search');
$form->addSubmit('reset', 'Reset');
return $form;
}
} and template: <table n:no-grid="grid">
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
<tr>
<td>
<input n:name="name">
</td>
<td>
<input n:name="search">
<input n:name="reset">
</td>
</tr>
</thead>
<tbody>
<tr n:no-grid-data-as="$user">
<td>
{$user->getName()}
</td>
<td>
<a href="#">Edit</a>
<a href="#">Remove</a>
</td>
</tr>
</tbody>
</table>
Btw if you would have some free time for creating PR, I would be really glad and happy 🍻 Write in case of any problem. |
The text was updated successfully, but these errors were encountered: