Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How to reload a store ?

  1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    10

    Question How to reload a store ?

    Hi everyone,

    Everything is in the title. I have a Ext.data.GroupingStore and I want to reload it after having clicked on a button.

    I try to use the load() function but it didn't work.

    My store :

    var store = new Ext.data.GroupingStore({
    proxy: new Ext.data.HttpProxy({
    url: 'Name of my servlet', timeout: 300000}),
    reader: new Ext.data.JsonReader({
    root: "result",
    fields: [
    {name: "Id"},
    {name: "movieTitle"},
    {name: "type"}
    ]
    }),
    remoteSort: false,
    sortInfo: {
    field: 'type',
    direction: 'ASC'
    },
    data: {result:rs.storeList},
    fields: ["Id","movieTitle","type"],
    groupField: "type"
    });

    in my function called when the button is clicked :

    store.load();

    I know load() function is asynchronous. i see with firebug that my rs.storeList has been updated but i don't know how to use my updated list.

    Any tips ?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Look at the API to see if there's a reload function?

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    10

    Default

    I saw the REload() function but i don't know why i can't make it work.

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    What debugging have you done?

  5. #5
    Ext User
    Join Date
    Aug 2010
    Posts
    10

    Default

    Quite simple actually.
    I put two alerts : one before the reload() function call and the same after : alert(store.getCount()). Both display the same number.

  6. #6
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Loading is asynchronous!!!

    You can only check the number of records AFTER the new data from the server is received.

    Try:
    Code:
    store.reload({
      callback: function(){
        alert(store.getCount());
      }
    });

  7. #7
    Ext User
    Join Date
    Aug 2010
    Posts
    10

    Default

    Still the same number even if i use your code Condor.
    I don't know what to do. The most frustating is that I can see in the servlet response displayed by firebug the result I want.

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Are you saying the new Records are not being loaded? I don't understand what the problem is.

  9. #9
    Ext User
    Join Date
    Aug 2010
    Posts
    10

    Default

    When I call the reload() function, I see in the firebug console that my servlet is actually called and returned the right list. But the data in my store remain the same.

  10. #10
    Ext User
    Join Date
    Aug 2010
    Posts
    10

    Default

    Yeah, you're right, the new Records aren't being loaded from the servlet response.

Page 1 of 2 12 LastLast

Similar Threads

  1. When to reload a store
    By douggiefox in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 27 Jan 2010, 12:39 AM
  2. Store Reload
    By dirkpitt_10 in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 9 Nov 2009, 4:22 AM
  3. [Solved]store.getCount() after store.reload()
    By adbox in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 6 Feb 2009, 1:49 PM
  4. Mask a grid before store.reload() method and Unmask after store.reload()
    By faqlcp in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 23 Nov 2008, 10:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •