External Pagination: totalItems and pagination toolbar inconsistency.
#4,434 opened on Sep 24, 2015
Description
I thought of a simple trick to avoid displaying the blank white grid body that so many have complained about when no data is loaded. The trick is to set the grid's columndef data to be [ {}, {}, {}, {}, {}, {}, {}, {}, {}, {} ] so that it displays alternating row colors in what looks like an empty grid as shown below. This grid is setup to use external pagination and external sorting, and as you can see the page size is currently 10, equaling the number of empty objects I stored in the data array.
However, when you do this, the next page button in the pagination toolbar is enabled even though the totalItems columndef option is set to 0. And if I change the totalItems columndef option to be a non-zero number that is less than the pageSize, the next page button is disabled. I find it strange that the disabling of the next page button is contingent on a non-zero number for totalitems when it should also be disabled if the totalItems option is 0, regardless of what is stored in the data columndef option.
IMO, the external pagination toolbar's next page button's enabled status should solely be determined from the totalItems, pageSize, and current page number because that's all the info you need to know if there is another page of records to navigate to. If this could be addressed in some way and the next page button be disabled when totalItems = 0, then the trick I mentioned above could give users a simple way to fill the grid with empty rows of alternating color so that the grid doesn't look blank and empty. The other thing I thought about was filtering for this scenario, again if totalItems is 0, simply don't filter, that way the empty rows of alternating colors remains visiable until totalItems changes to a non-zero number and the data object actually contains data. I understand it's probably more complicated than this, but just wanted to give my two cents on the issue. Thanks for your time.