I have a CGridView with some data to display in it. I want to disable pagination and limit number of rows that can be displayed. I use the code:
'enablePagination' => false
and it did a half of the job: the paginator is gone, but the problem is that the grid shows now in summary that total number of records is equal to the page size. That’s not true. I need that total number of records to be reported correctly.
For example, if pageSize is 5 and there exist 7 records, CGridView reports "Displaying 1-5 of 7 results." when pagination is enabled, but it shows "Total 5 results." when pagination is disabled. I played with summaryText template, but it seems that {count} is incorrect when pagination is disabled.
In other words, is there a way to always have the summary "Displaying 1-5 of 7 results." irrespective to the fact if pagination is enabled?
This does not solve the problem. When I disable pagination in the data provider, I lost a possibility to limit number of records on a page via pageSize, and I see all records listed.
Moreover, this data provider is used by several pages, and I need to disable pagination only in one of them.
Yes, this is not what I’m looking for. This will preserve pagination, while I need to suppress it, totalItemCount should be automatically assigned from DB as it was with enabled pagination.
Currently I hide incorrect summary via summaryCssClass as a workaround.