1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    dshieh is on a distinguished road

      0  

    Default 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);

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    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.

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    dshieh is on a distinguished road

      0  

    Default


    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?

    Quote Originally Posted by jacksloc
    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.

  4. #4
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    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.

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    dshieh is on a distinguished road

      0  

    Default


    Okay. But, I don't see where (in forum.js) this is hooked up to the paging buttons on the grid's paging toolbar.

    Quote Originally Posted by jacksloc
    On the server. When topics.php is called, it is passed a page number and a pageSize.

  6. #6
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    2
    tryanDLS is on a distinguished road

      0  

    Default


    It's in the onClick in PagedGridView which is handling the default paging process

  7. #7
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

  8. #8
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    dshieh is on a distinguished road

      0  

    Default


    Thanks, Jack, for the recommendation. That has been the post I've been using to familiarize myself with the Grid component. I had missed:
    By default the model appends the following parameters to paging and sorting requests: page, pageSize, sortColumn and sortDir.
    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.

    Quote Originally Posted by jacksloc

Similar Threads

  1. Scrolling (rather than paging) grid
    By elygre in forum Ext 1.x: User Extensions and Plugins
    Replies: 76
    Last Post: 25 Mar 2008, 7:04 AM
  2. Paging Grid...
    By fredstra in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 7 Mar 2007, 7:55 AM
  3. regarding paging grid
    By noname in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 1 Mar 2007, 4:54 AM
  4. XHR Grid Paging
    By Ramsay in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 27 Feb 2007, 7:57 PM
  5. Does Grid.autoSize factor in paging toolbar for paged grid?
    By davida in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 28 Dec 2006, 9:47 AM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar