kartik-v / yii2-dynagrid

Turbo charge the Yii 2 GridView with personalized columns, page size, and themes.
http://demos.krajee.com/dynagrid
Other
74 stars 66 forks source link

setting pagination and sort to false does not work in dynagrid #44

Closed akorinek closed 9 years ago

akorinek commented 9 years ago

I'm trying to disable sort and pagination, as documented here: http://www.yiiframework.com/doc-2.0/yii-data-basedataprovider.html#$pagination-detail

If I use a yii2 gridview, this works, in a dynagrid this throws an error. Here is the code:

$SampleSearchModel = new SampleSearch(); $searchparam = ArrayHelper::Merge(Yii::$app->request->queryParams, ['SampleSearch' => ['job_id' => $id]]); $SampleDataProvider = $SampleSearchModel->search($searchparam); $SampleDataProvider->pagination = false;

Gives the following error: Creating default object from empty value

Dynagrid.php line 877: $pagination->pageSize = $this->_pageSize;

The same with sort:

Call to a member function getOrders() on boolean Dynagrid.php line 999: $model->data = $this->gridOptions['dataProvider']->getSort()->getOrders();

kartik-v commented 9 years ago

The dynagrid is used to set a custom pagesize or sort. It seems you are disabling that functionality? Then why do you need a Dynagrid (and not a normal yii2-grid) - is it just for the column realignment?

akorinek commented 9 years ago

It's for column realignment, export and so on. Also, it would be nice from a reusable code standpoint not to have to mix yii gridviews with your gridviews. Also the styling is a bit different between the two.

kartik-v commented 9 years ago

Export is a yii2-grid functionality.

Dynagrid is used for realigning columns, setting and saving custom sort, setting and saving custom pagesize and save filters.

The way its designed it needs some code rehaul to support disabling of some of the above functionality. Will need to probably look at it later when I get time.

dvdkrgr commented 9 years ago

Any updates on this one? I want to display a DynaGrid for the filters, column realignment and so on. But it should display all the data without any pagination. Like @akorinek said setting pagination to 'false' will cause an error.

kartik-v commented 9 years ago

Disabling pagination is another issue. Please raise one. This can be taken up as an enhancement and will include this when I get time.

kartik-v commented 9 years ago

Refer enhancement #59. You can now set pagesize to 0 from the dynagrid configuration form to show all rows on one page.

If you want to disable pagination for all -- set Module::defaultPageSize to 0.

kartik-v commented 9 years ago

New enhancements added via #60 and #61.... you can now set pagination and sort to false for gridOptions['dataProvider']` to disable pagination and sort for the grid.

rmramyait commented 5 years ago

Hi... I am using Export menu and Pjax. I am having more than 1000 records. In records per page , I cant able to selct 50,100,200. Only 20 records are displaying so in output Excel I am getting only 20 records