Closed dudunegrinhu closed 9 years ago
you must also set in modules
'modules' => [ 'dynagrid'=> [ 'class'=>'\kartik\dynagrid\Module', 'defaultPageSize'=>0, //this line ],
But what if we want to have 2 dynagrids with 2 different defaultPageSize? How can that be achieved?
It looks like the module configuration is set for all dynagrids. Also, it seems pagination in the DataProvider gets overridden by the module config. I don't know how to have 2 different dynagrids with 2 different page sizes.
If you need to set differing default page sizes for your dynagrids (a common scenario, i would think), then unfortunately something like $dataProvider->setPagination(['pageSize' => 100]);
does not work because of line 613 in DynaGrid.php:
if (!isset($this->_pageSize) || $this->_pageSize === null) {
$this->_pageSize = $this->_module->defaultPageSize;
}
You can, however, set a default page size in your configuration:
$config =
['modules' =>
['dynagrid'=>
[
'class'=>'\kartik\dynagrid\Module',
'defaultPageSize'=>20,....
And you can change this "on-the-fly" in your code before generating your datagrid:
\Yii::$app->getModule('dynagrid')->defaultPageSize = 50;
echo DynaGrid::widget([...
Hi, I'm not being able to show all results in the grid. I'm doing:
$dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pagesize' => 0 // in case you want a default pagesize ] ]);
but it still showing 10 results instead of all. What am I missing?