1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Melbourne, Australia
    Posts
    8
    Vote Rating
    0
    schmoove_nz is on a distinguished road

      0  

    Default Unanswered: What is the correct method for loading windows with multiple-store content?

    Unanswered: What is the correct method for loading windows with multiple-store content?


    Hi everyone,

    I'm having a tough time figuring out some glitches in my ExtJS 4 app when I am attempting to open windows that have form/grid content within them that requires the loading of several data stores first. Doing this as I am seems to corrupt the rendering of the window (weird ghosting effects when drag/window wont close etc), so my feeling is I have either scope or component cycle issues.

    Example code:

    Code:
    this.bookingGrid.on('itemdblclick', function(e,t,o) {
            
                var loadingMask = new Ext.LoadMask(Ext.getBody(), {msg:"Loading…"});
                loadingMask.show();
    
                var storesToLoad = [
                       {    
                           store:     'BookingScheduleStore', 
                           url:     '/api/bookings/' + t.internalId + '/schedule' 
                       },
                       {    
                           store:     'BookingFlightStore', 
                           url:     '/api/bookings/' + t.internalId + '/flights' 
                       },
                       {    
                           store:     'AttachmentStore', 
                           url:     '/api/bookings/' + t.internalId + '/attachments' 
                       },
                       {    
                           store:     'BookingSupplierStore', 
                           url:     '/api/bookings/' + t.internalId + '/suppliers' 
                       }
                ];
                this.loadBooking = function(record, options, success) {
                     var task = storesToLoad.shift();
                     if(task){
                        if(success !== false){
                          task.callback = arguments.callee;
                          var store = Ext.getStore(task.store);
                          store.proxy.url = task.url;
                          store ? store.load(task) : console.log('bad store specified');
                        } else { 
                          console.log('complain');
                        }
                     } else {
                         loadingMask.hide();
                         if (!this.bookingWindow) {
                              this.bookingWindow = new Ext.App.Booking.BookingWindow();
                        }
                        this.bookingWindow.child('form').getForm().loadRecord(t);
                        this.bookingWindow.show();
                     }
                };
                this.loadBooking();
                
            },this);
    Since loadBooking() loads all the necessary stores before the window is created, I wouldn't have thought it would be an issue, but should I be doing the form loadRecord() on an afterRender event in the window to populate the form correctly, instead of having it so close to the window.show()?

    I've searched everywhere for a standard-practice method of doing this, but no luck- any advice from Ext JS wizards would be much appreciated - it's the one thing breaking my app.

    Many thanks,

    Ryan

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,065
    Answers
    3498
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tested this in a simplified test case? Basically creating a window with your layout and use stores with local data (no Ajax call, just set the data config on the store)
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Location
    Melbourne, Australia
    Posts
    8
    Vote Rating
    0
    schmoove_nz is on a distinguished road

      0  

    Default


    Yes, I'm getting these glitches just creating the window layout (without loading any stores) and firing window.show()
    I'm going to swap out 4.0.7 for 4.0.2a and see if it makes any difference

Thread Participants: 1