Grids
Grids copied to clipboard
How to set params to pagination page
Hi ! i'm not use filter of grid , i have grid and other form . http://prntscr.com/evfa4o When i search and then next page the request params reset . how to set that on next page ?
In your page there are two form so basically you cannot submit them at the same time .
workaround
Using only html5 you can ( ex. using grid name as doc)
- do not include your filters input inside a form
<input name="doc[filters][your_filter_name]" form="my_grid">
- reference them in the grid form ( you must create a template of grid.php and give it an ID )
<form id="my_grid">
the only problem is that they are not filled in the next page
tested!
👍 but i have more than page like that :((
Hi!
- Why not place your inputs inside grid form?
- I don't recognize language on screen but suggest that there is filters for grid inside form. If I'm right, you can use Components/Filter.php. You can fully customize its appearance & filtering method (use callback in $filteringFunc & do anything you want with QueryBuilder).
1 . beacasue i need create filter without gird not header / Footer of grid , 2. year that filters not inside form of gird. but i don't wan add to header or footer of gird . Beacasue my layout with two sections : filters, grid . and filter not on gird. Solutions
- Mabe i have must create layouts for gird and take filter inside
- replace name input filters if fiter not inside gird
Mabe i have must create layouts for gird and take filter inside
You can create your own grid template based on https://github.com/Nayjest/Grids/blob/master/resources/views/default/grid.php and place anything you want inside grid form. Use GridConfig::setTemplate() to change template.
Hi
I'm doing some test on builing a custom grid layout adding some new "filter fields", calling those filters with the syntax gridName[filters][filterName]
I'm able to use them in all pages otherwise they will be removed when I change page.
How can I define a custom filter function in the Controller for those new inputs written in the view?
(we're getting closer to the solution :smile: )
@wdog If you don't use Filter component, just adding HTML inputs to layout, You can read input (Input::get('grid_name.filters.some_field')) in Controller before constructing grid and apply your filters to instance of QueryBuilder that will be used with grid.
I've just found a simple way to set default filter if they are not set, I don't know where to store this snippet so I put here in case someone will need it. ( maybe can I create a wiki page called snippets?)
$request = Request();
if ( !\Input::get( 'grid.filters.years-eq' ) ) {
$request->request->add([ 'grid' => ['filters' => ['years-eq' => Carbon::now()->year]]]);
}
just call it before the grid creation