Threaded View

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2010
    Location
    Northern Virginia
    Posts
    59
    Vote Rating
    4
    aghextjs is on a distinguished road

      3  

    Default Ext.ux.data.PagingStore - updated for Ext JS 4

    Ext.ux.data.PagingStore - updated for Ext JS 4


    Updating an Ext JS 3 app, finally forced me to need Condor's Ext.ux.data.PagingStore extension, since I couldn't find one amongst the 270+ posts on the thread at http://www.sencha.com/forum/showthre...gingStore-v0.5.

    Code is at: https://github.com/aghuddleston/Ext.ux.data.PagingStore

    The main difference from the Ext JS 3 version is that start, limit and page are no longer part of params, but are their own properties on the options config used during store load.

    Example remote store (note last options):
    PHP Code:
         var myStore Ext.create('Ext.ux.data.PagingStore', {
             
    model'User',
             
    pageSize3,
             
    lastOptions: {start0limit3page1},
             
    proxy: {
                 
    type'ajax',
                 
    url'url/goes/here',
                 
    reader: {
                     
    type'json',
                     
    root'rows'
                 
    }
             }
         }); 
    Example local store:
    PHP Code:
        var myStore Ext.create('Ext.ux.data.PagingStore', {
             
    model'User',
             
    pageSize3,
             
    proxy: {
                 
    type'memory',
                 
    reader: {
                     
    type'array'
                 
    }
             },
             
    datadata
         
    }); 
    My goal was to match the behavior of the Ext JS 3 version, so it should only request new data if params or extraParams changes, otherwise it is just paging through the existing store. To force a reload, make sure to delete store.lastParams before store.load is called.

    It is very lightly tested so far, with Ext JS 4.1.1. Feel free to fork, push/pull etc for any needed changes/enhancements.

    Update (8/8/14)
    - Version in GitHub tested with
    - Ext JS 4.1.1 (master branch)
    - Ext JS 4.2.1 (extjs-4.2-branch)

    By the way, the extjs-5.0-branch completely fails and does not work.
    Last edited by aghextjs; 8 Aug 2014 at 6:11 AM. Reason: Updating version info