Check the latest version of yii2-dynagrid extension. It allows you to personalize, save, or modify grid filters, sorts, pagesize, column order, grid theme etc.
I’m getting a error - illegal string offset ‘data-pjax’ that comes up when I attempt to implement the export configuration. Trace log shows line 565 in gridview.php function initExport()
This widget has inbuilt support for PJAX. The recommended method to implement PJAX hence should be to use the internal feature - because the extension automatically initializes the other plugins like export, tableHeader etc.
Do not wrap your widget in pjax - instead set the pjax property of GridView to true. Read more about it and pjax settings in the docs.
Sorry for wasting your time here - I must have looked at it 100 times and didn’t see the bad formatting I had on the ‘exportConfig’ options. All works great.
I’m learning YII2 (I don’t have any previous experience in yii) and would like to continue with your gridview demo (espcially, the status “enable/disable” for all rows and for individual row…). The easist way for me to learn is to follow a working example as staring point and try to make some modifications from it.
The question: Could I get access to the .sql script fot setting the db for the demo (the book demo…)? And maybe the complete working code?
I just started looking at PJAX and may have misunderstood how PJAX works, but is it possible to have a Gridview in a div on a page so that when you page through the Gridview the updates stay inside that one div? When I page to the next Gridview page, the data overwrites my whole screen.
Just wondering if it is possible to use a multi-select checkbox as a filter in one of the Griview columns? If so, could someone please give me an example of the syntax I would use for the ‘filter’ to perform this? I already have an array of key->value pairs with which to populate this.
With release 3.0.5 of yii2-grid, grid grouping functionalities have been added that allow to group data including master-detail nesting, adding group summaries, dynamic formatting and more. Refer group grid documentation and grid grouping demo for details.
in the controller, if put the value in the variable $output works!
if ($model->load($post)) {
$model->save();
if (isset($posted['id_provincia'])) {
$output = $model->provincia->descripcion; // process as you need
}
$out = Json::encode(['output'=>$output, 'message'=>'']);
}
// return ajax json encoded response and exit
echo $out;
return;
I love the extension. I had an issue with my database columns, I had used the same column name in different tables and relating them gave me integrity constraint errors when I searched in the grid view filters. I renamed the offending columns in the database, and went through all of my model, controller and view code to add the new name. After doing this, the grid view filters have no effect, I can type in them but nothing happens. When I change
use kartik\grid\Gridview;
to
use yii\grid\Gridview;
every works in the filters. Any ideas as to what could be the reason?