1

Output looks like this---------- Hi, I am using JQuery bootgrid to display a few hundred records. I am returning a rowCount=10 from server side but its not work and keep showing all the rows.

My source looks like this: HTML:

<th data-column-id='ItemID' data-type='numeric' data-identifier='true'>ID</th>"+
                                "<th data-column-id='ItemNumber'>Item Number</th>"+
                                "<th data-column-id='ItemDescription'>Description</th>"+
                                "<th data-column-id='ItemStatus'>Status</th>"+
                                "<th data-column-id='DateReceived'>Received Date</th>"+
                                "<th data-column-id='ItemNotes' data-formatter='text' data-sortable='false'>Text Description</th>"+
                                //"<th data-column-id='NoOfItems' data-formatter='select' data-sortable='false'>No. of Items</th>"+
                                "<th data-column-id='commands' data-formatter='commands' data-sortable='false'>Actions</th>";

Ajax Request:
current "1"
rowCount    "10"
searchPhrase    ""

Ajax Response:
current 1
rowCount    10
rows    [12]
0   Object
1   Object
2   Object
3   Object
4   Object
5   Object
6   Object
7   Object
8   Object
9   Object
10  Object
11  Object
total   12

Any help will be appreciated. Thanks

Rohit Poudel
  • 1,793
  • 2
  • 20
  • 24

1 Answers1

3

This confuses many people at first, as it did me.

It's important to remember that pagination is not done by JQ-BG. It's done by the server. JQ-BG only tells the server what page the user is requesting and details like rows per page, search strings, sorted columns, etc. It's up to the server to first filter by the search string (if applicable), sort according to the sorted column, and then do the math about which rows in that result set make up the page that the user is requesting. In the end, the server sends no more than one page's worth of rows. The server also feeds back the total number of pages that are available so that JQ-BG can arrange the tiled page numbers at the bottom for the user to click on.

In the end, this makes sense because no matter the size of the data, it isn't being all sent over the wire in a giant transaction that will, at some point, overwhelm the browser and make the network appear "slow".

But, it does create some challenges, like temporarily storing the filtered, sorted data across ajax requests and doing the pagination within the cached results.

Vic K
  • 135
  • 7