-
11 Dec 2006 10:16 AM #1
Grid not paging
Grid not paging
Using forums.js to help me get started using the Grid component, I am nonetheless not able to get paging to work. I have set page size to 10, whereas the total row count is 25. So, the grid toolbar correctly shows three pages. However, all 25 records are shown at once. Clicking on the paging buttons doesn't appear to do anything, since all 25 records are showing anyways.
Here is the relevant portion of my code:
Code:sm = new YAHOO.ext.grid.SingleSelectionModel(); sm.addListener('selectionchange', onSelection); cm = new YAHOO.ext.grid.DefaultColumnModel([ {header: "ID", width: 40}, {header: "Item", width: 100}, {header: "Value", width: 100} ]); cm.defaultSortable = true; dm = new YAHOO.ext.grid.XMLDataModel({ tagName: 'TestTable', id: 'pID', fields: ['pID', 'testItem', 'testValue'] }); dm.initPaging(url, 10); dm.baseParams = {'keyword': keyword}; dm.getTotalRowCount = function() { return 25; } dm.setDefaultSort(cm, 0, 'ASC'); grid = new YAHOO.ext.grid.Grid('target-results-grid', dm, cm, sm); grid.render(); var toolbar = grid.getView().getPageToolbar(); dm.loadPage(1);
-
11 Dec 2006 12:17 PM #2
Paging is done on the server. If you send 25 records back it will show 25 records.
FYI, when choosing which forum to post in, lean toward "Help" not "Bugs" unless you are certain it's a bug.
-
11 Dec 2006 12:44 PM #3
Thanks, Jack, for the assistance. I realized that I probably should've posted in Help a bit too late.
Regarding paging being performed on the server side, I'm a bit confused. Looking at topics.php, it looks like all records are returned all at once. However, the grid in forum.js shows only 20 records per page, which is how the grid is defined. So, where exactly is your recordset being limited to 20 records at a time?
Originally Posted by jacksloc
-
11 Dec 2006 12:56 PM #4
On the server. When topics.php is called, it is passed a page number and a pageSize. So if page is 3 and pageSize is 20, it will return records 41-60. This way you can work with a large recordset without loading all the records at once.
-
11 Dec 2006 2:37 PM #5
Okay. But, I don't see where (in forum.js) this is hooked up to the paging buttons on the grid's paging toolbar.
Originally Posted by jacksloc
-
11 Dec 2006 3:12 PM #6
It's in the onClick in PagedGridView which is handling the default paging process
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
11 Dec 2006 7:51 PM #7
-
12 Dec 2006 9:12 AM #8
Thanks, Jack, for the recommendation. That has been the post I've been using to familiarize myself with the Grid component. I had missed:
under your description of paramMap. Armed with that information and a modification of my database query on the server, I've gotten paging to work successfully. Thanks for your help, Jack.By default the model appends the following parameters to paging and sorting requests: page, pageSize, sortColumn and sortDir.
Originally Posted by jacksloc
Similar Threads
-
Scrolling (rather than paging) grid
By elygre in forum Ext 1.x: User Extensions and PluginsReplies: 76Last Post: 25 Mar 2008, 7:04 AM -
Paging Grid...
By fredstra in forum Ext 1.x: Help & DiscussionReplies: 5Last Post: 7 Mar 2007, 7:55 AM -
regarding paging grid
By noname in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 1 Mar 2007, 4:54 AM -
XHR Grid Paging
By Ramsay in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 27 Feb 2007, 7:57 PM -
Does Grid.autoSize factor in paging toolbar for paged grid?
By davida in forum Ext 1.x: Help & DiscussionReplies: 4Last Post: 28 Dec 2006, 9:47 AM


Reply With Quote