Hybrid View

  1. #1
    Ext User
    Join Date
    Sep 2007
    Location
    US - Iowa
    Posts
    13
    Vote Rating
    1
    cleancutEddie is on a distinguished road

      1  

    Default grid pagination, sort help

    grid pagination, sort help


    I'm new to extjs grid, and need some help with the sort (it's visible but not working), and pagination. I took the basic "sample" grid example by bd318, and modified the files (sample.js, sample.php, sample.html) for my data. It's using Json. The good news is that it successfully retrieves the data and puts it in the grid. However, I've got two problems:

    1) I can't figure out how to provide pagination.
    2) When I right-click on the column and click sort-ascending or sort-descending, nothing happens.

    Thanks in advance.

  2. #2
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    The grid has two sort-options.
    if this is set:
    remoteSort: true
    a request is send to the external file with the sort-param as GET/POST, so the script has to retrieve the sorted data.
    If the flag is not set, the grid sorts the "visible" rows (like in the examples)

    Pagination is really simple, you do that by this code:
    PHP Code:
    var gridFoot grid.getView().getFooterPanel(true);

            
    // add a paging toolbar to the grid's footer
    var paging = new Ext.PagingToolbar(gridFootds, {
        
    pageSizelimit,
        
    displayInfotrue,
        
    displayMsg'show data {0} - {1} from total {2}',
        
    emptyMsg"no data found"
    }); 
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Ext User
    Join Date
    Sep 2007
    Location
    US - Iowa
    Posts
    13
    Vote Rating
    1
    cleancutEddie is on a distinguished road

      0  

    Default


    I've done what you said, and the pagination is still not working. Thanks.

  4. #4
    Ext User jimmyphp's Avatar
    Join Date
    Mar 2007
    Posts
    77
    Vote Rating
    0
    jimmyphp is on a distinguished road

      0  

    Default


    Check with firebug your server response.

    Is sorted?

    post your php code.

  5. #5
    Ext User
    Join Date
    Sep 2007
    Location
    US - Iowa
    Posts
    13
    Vote Rating
    1
    cleancutEddie is on a distinguished road

      0  

    Default


    The PHP code that I'm using is really basic:

    PHP Code:
    <head>
    <
    script language="JavaScript" type="text/javascript" src="../jscss/extjs/adapter/ext/ext-base.js"></script>
    <script language="JavaScript" type="text/javascript" src="../jscss/extjs/ext-all.js"></script>
    <script language="JavaScript" type="text/javascript" src="sample.js"></script>
    <link rel="stylesheet" type="text/css" href="../jscss/extjs/resources/css/ext-all.css" media="screen" />
    </head>

    <body>
    <div id="grid-panel" style="width:720px;height:480px;"> 
    <div id="editor-grid"></div> 

    <div id="editGrid"> 
    </div>
    </body> 
    And, the js file includes:

    PHP Code:
        var gridFoot grid.getView().getFooterPanel(true);

        
    // add a paging toolbar to the grid's footer
        
    var paging = new Ext.PagingToolbar(gridFootds, {
            
    pageSizeps,
            
    displayInfotrue,
            
    displayMsg'Displaying configuration {0} - {1} of {2}',
            
    emptyMsg"No data available"
        
    }); 
    Again, the data is there, the columns sort properly. Everything works, except it doesn't paginate. What am I missing, or doing incorrectly? Thanks.

    cleanCutEddie

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,008
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      -1  

    Default


    When you say it doesn't paginate, do you mean you always have the full number of results returned, or you only ever get the first page?

    Is your PHP code limiting the amount of records it returns? Because this must be done server side.

  7. #7
    Ext JS Premium Member
    Join Date
    Oct 2008
    Posts
    18
    Vote Rating
    1
    lechenique is on a distinguished road

      0  

    Default


    Quote Originally Posted by steffenk View Post
    The grid has two sort-options.
    if this is set:
    remoteSort: true ...[/php]
    I think that is the Store object who exposes the 'remoteSort' property, not the grid.