1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    ivan92 is on a distinguished road

      0  

    Default Answered: Get ListStore from a local paging Grid

    Answered: Get ListStore from a local paging Grid


    Hi:

    I have a problem with getting the list of all items of my editable local paging grid (After edit, of course). When i type:
    Code:
    listStore.getModels()
    Only return the items that are shown on the current page of the grid. I need to get all the item at all the pages. (i dont know if i can get all complete list or i have to get one page-list at a time)
    I am using this to implements the paging:
    Code:
        List<Facultad> res = new ArrayList<Facultad>();        
        PagingModelMemoryProxy proxy = new PagingModelMemoryProxy(res);
        PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
        ListStore<Facultad> listStore= new ListStore<Facultad>(loader);
        PagingToolBar toolBar = new PagingToolBar(10);
        .
        .
        .
        (OTHER CODE)
        .
        .
        .
        //"resultado" is the list that i get from a RPC call to reload the grid
        public void reloadGrid(List<Facultad> resultado) {
            proxy = new PagingModelMemoryProxy(resultado);
            loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
            loader.setRemoteSort(true);
            listStore= new ListStore<Facultad>(loader);
    
            toolBar.bind(loader);
            loader.load(0, 10);
    
            grid.reconfigure(listStore, cm);
        }
    Thanks for your time!

  2. solved the problem with this:
    Code:
    for (int i = 1; i <= toolBar.getTotalPages(); i++) {   
         toolBar.setActivePage(i);
         myTotalList.addAll(grid.getStore().getModels());                                 
    }

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Paging allows the client to not need to download or display every single possible item. This means the database call can be faster - it only needs to read out some, not all items, the download can be faster - it only has to send the current page, the display can be faster - it only draws the current page.

    It sounds like you actually want to load *every single item* on to the client, then only display some of them? This means that the database will need load out each object, the client will need to download them and deserialize them, and the browser will have to hold them all in memory, though it won't display them all at once. For any more than (give or take, depends on browser and how big each object is) a few thousand items, this may result in the browser hanging, just in deserializing the items, and may make download times much longer than you want. Is this really what you want?

  4. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    ivan92 is on a distinguished road

      0  

    Default


    solved the problem with this:
    Code:
    for (int i = 1; i <= toolBar.getTotalPages(); i++) {   
         toolBar.setActivePage(i);
         myTotalList.addAll(grid.getStore().getModels());                                 
    }

Thread Participants: 1

Tags for this Thread