Hybrid View

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

      0  

    Default Grid: Paging of JavaScript Array already in memory

    Grid: Paging of JavaScript Array already in memory


    Hello,

    i want to page the contents of a Java Script array with 50 rows (no server side paging here) directly on the client, showing the array in pages of 15 entries.

    My problem now is, that the grid always shows all of the 50 objects within the Data.Store, although i defined:
    ds.load({params:{start:0, limit:15}});

    I use a regular ArrayReader and a MemoryProxy.

    Funny thing is, the footer displays the correct number of entries in the array and the page numbers are also correct. But unfortunately i can´t skip through the in memory data.

    Can anybody help me here?
    What do I have to do, to enable Client Side paging?

    The relevant code i currently use for this:
    Code:
        var ds = new Ext.data.Store({               
                                proxy: new Ext.data.MemoryProxy(myJavaScriptArray),
                              reader: new Ext.data.ArrayReader(
                              {totalProperty: 50',
                               id: 0},
                               […
    //some more code here
                                  ...     ]
    
            grid.render();     
           
            var gridFoot = grid.getView().getFooterPanel(true);
    
            // add a paging toolbar to the grid's footer
            var paging = new Ext.PagingToolbar(gridFoot, ds, {
                pageSize: 15,
                displayInfo: true,
                displayMsg: 'Displaying topics {0} - {1} of {2}',
                emptyMsg: "No topics to display"
            });         
           
            // trigger the data store load
            ds.load({params:{start:0, limit:15}});

  2. #2
    Ext Premium Member BernardChhun's Avatar
    Join Date
    Mar 2007
    Location
    Quebec, Canada
    Posts
    831
    Vote Rating
    2
    BernardChhun will become famous soon enough

      0  

    Default


    correct me if I'm wrong but the grid is using remote paging with the HttpProxy only.

    I'm not a 100% sure about this but local paging isn't working.

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

      0  

    Default


    Thanks for the answer.

    Can anybody confirm, that local paging is not supported? I mean it´s almost working as far as the footer navigation goes.

    And, if local paging is not supported, can one give me a hint on how to implement this? I mean, the data is already in the proxy and the reader would have to skip through the array somehow...

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    403
    Vote Rating
    0
    KimH is on a distinguished road

      0  

    Default


    Local paging is NOT supported.... but my guess is that it will be in an upcomming release/revision as this question has been asked several times now...

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,503
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I don't understand why you'd want it. Given that the data is there in the page, surely it's more convenient and intuitive to use the scrollbar for the purpose for which it was provided?

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    30
    Vote Rating
    0
    Preston is on a distinguished road

      0  

    Default


    Yeah, I agree with you Animal. However my table has LOTS of columns (e.g.25) and when stuffing in 1000 rows all at once the rendering takes a lot of time. So paging with 50 or so shown on one page is my only way out of this misery.

    I have no possibility of paging the data sets through another server round-trip, because it is not possible within my application architecture (as strange as this sounds).

  7. #7
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    NL
    Posts
    608
    Vote Rating
    1
    mdissel is on a distinguished road

      0  

    Default


    Another reason to support "in-memory-paging" is to make it possible to load the first page of the grid during the initial loading of the page, instead of running an extra ajax call after the page has been loaded.


    Thanks

    Marco

  8. #8
    Sencha - Community Support Team JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
    JeffHowden is on a distinguished road

      0  

    Default


    Quote Originally Posted by mdissel
    Another reason to support "in-memory-paging" is to make it possible to load the first page of the grid during the initial loading of the page, instead of running an extra ajax call after the page has been loaded.
    That'd be more complicated as you'd need to switch from a memory proxy to an http proxy for subsequent calls.
    Jeff Howden
    Ext JS - Support Team Volunteer
    jeff@extjs.com

    Any and all code samples that are authored by me and posted on the Ext forums or website are hereby released into the public domain and I release anyone or entity of liability by using said code samples unless explicitly stated otherwise.

    Opinions are mine and not necessarily endorsed by Ext, LLC. Please do not contact me directly for assistance unless requested by me.

  9. #9
    Ext User
    Join Date
    Apr 2007
    Posts
    1
    Vote Rating
    0
    cyberlot is on a distinguished road

      0  

    Default


    Quote Originally Posted by JeffHowden View Post
    That'd be more complicated as you'd need to switch from a memory proxy to an http proxy for subsequent calls.
    Just want to get some sort of verification, Will local paging be supported at some point???

    Local paging would be great for reducing server load.

  10. #10
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,503
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Well, it will move the server load.

    The extraction of the whole dataset from the database, and the downloading of the data into the browser happen up front before the page is rendered, rather than on demand, and only if the user decides to view more pages.

Similar Threads

  1. [SOLVED] Memory Leak in Paging Grid Example?
    By cobnet in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 3 May 2007, 8:24 PM
  2. Grid DataModel keeps data in memory
    By tane in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 24 Feb 2007, 12:38 PM
  3. How to call array-grid?
    By sailaja in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 16 Jan 2007, 6:56 AM
  4. Array-Grid in YUI
    By sailaja in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 10 Jan 2007, 3:18 AM
  5. Array Grid Example
    By qintnt in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 4 Dec 2006, 5:06 AM

Thread Participants: 19