Art F
Art F

Reputation: 4202

ExtJs not refreshing propertly

In ExtJs, I have a handler attached to a button, which calls submit() on an Ext.form.Panel. I then have a component that I am trying to refresh (store and view). What I discovered is that, the submit component takes too long and the refresh executes too early. I was wondering if there is any way in this situation to wait until the call responds? My code looks like this:

handler: function() {
                   new_folder_panel.submit();
                   win2.hide();
                   store_dir.load()
                   tree_dir.getView().refresh();
                   console.log("It is here");
                }

I did try using pure javascript's window.setTimeout, and forcing the refresh to wait which works, but I am hoping for a better way.

Upvotes: 0

Views: 82

Answers (1)

lontivero
lontivero

Reputation: 5275

Yes, you have to use the success callback as follow:

handler: function() {
    new_folder_panel.submit({
        success : function(){
           win2.hide();
           store_dir.load()
           tree_dir.getView().refresh();
           console.log("It is here");
        }
    });
}

I didn´t test it but this is the way to go.

Good luck!

Upvotes: 1

Related Questions