1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    23
    Answers
    1
    Vote Rating
    0
    shwetapro is on a distinguished road

      0  

    Default Unanswered: How to refresh or re-render TreePanel ExtJS4?

    Unanswered: How to refresh or re-render TreePanel ExtJS4?


    Hi,

    I have a list of records in a tree panel ExtJS4.
    I can delete a record through delete button below the treepanel. After the delete service is sent to the server, refreshed data is collected in treestore of the treepanel. But when I load the store through Ext.applyand then refresh the view of the treepanel, then too the tree is not refreshed, i.e. I can still see the deleted record.
    The record gets removed from the panel when I re-login into the application, ie. tree is not getting refreshed.

    Please find below code (I have tried all the below codes but the screen is not getting refreshed):

    Ext.apply(plansPanel.getStore(), store);

    Ext.apply(plansPanel, {
    store: store
    });

    plansPanel.render();

    plansPanel.getRootNode().collapse();
    plansPanel.getRootNode().expand();

    plansPanel.view.refresh();
    plansPanel.view.render();

    plansPanel.getView().refresh();
    plansPanel.getView().render();

    plansPanel.render();

    plansPanel.getRootNode().collapse();
    plansPanel.getRootNode().expand();

    plansPanel.render();


    Help appreciated.

    Thanks,
    Shweta

  2. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    Reloading your TreePanel's store should be as easy as:

    Code:
    yourTreePanel.getStore().load();
    It sounds as if you're having one of two problems: 1.) Your browser is caching JSON responses or 2.) the delete is failing server-side.

    I'd eliminate possibility #2 first by sprinkling a little logging code in the server-side method which performs the delete and use Firefox/Firebug or Chrome Developer tools to inspect the response to the client to ensure that data for the deleted record is not present.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    23
    Answers
    1
    Vote Rating
    0
    shwetapro is on a distinguished road

      0  

    Default


    Thanks for replying friend.

    I've already tried it. But treestore's load method throws error. (a is undefined)

    Moreover browser isn't caching the JSON response, neither is the server request failing.

    As soon as the server request gets fired, I debugged the code on server class and store data on Firebug. In both cases the data is correct and updated.

    Help appreciated.

    Thanks,
    Shweta

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,872
    Answers
    653
    Vote Rating
    438
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Are there any errors in the console?
    What is your header/response .. any errors on the server? do you get a response?

    This should be straight forward.

    Scott.

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    23
    Answers
    1
    Vote Rating
    0
    shwetapro is on a distinguished road

      0  

    Default


    Thanks for replying Scott martin.

    There isn't any error on the console. And to delete a record, the command fired does not gives back any response. It only gives a success or error code stating whether the record is deleted or not. In my case it gives a success code.

    To retrieve the fresh data I had fired the same command which I initially did to load the tree panel. After this command is fired, I can see the new data in store as well as in tree but tree does not gets refreshed somehow.

    Help appreciated.

    Thanks,
    Shweta

Thread Participants: 2

Tags for this Thread