Results 1 to 5 of 5

Thread: Delaying view render until data has loaded

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User jlyman's Avatar
    Join Date
    Nov 2010
    Vote Rating

    Default Answered: Delaying view render until data has loaded

    Is there a way by listening to the right events that you can get a store to reload and modify a view before it has been rendered to the screen, but after it has been added to the viewport? Currently, I have the following which will give me fresh data, but because the view as already been rendered, its height is not correct and will not scroll:

    PHP Code:
    show: function () {
    console.log('Checklists view activated.');
    Ext.getStore('Checklists').load(function(recordsoperationsuccess) {
    console.log('Reloaded checklist items...');
    this.renderChecklists(); // This line programmatically adds new elements to the view
    }, this);

    Ideally, I'd like to try and get things to work as follows, but there may be a better way to do this, which I'm all open to. (Note that I'm not using a DataView bound to a store to do any of this.)
    1. Checklist view gets requested to be shown via a Viewport.add()
    2. Either the checklist controller or the checklist view catches that it is about to be shown
    3. The store for checklists gets reloaded with fresh data
    4. New elements are created programmatically for items in the checklists store
    5. These new elements are added to the view
    6. The view is shown to the user.
    What's the best/right way to go about something like this? Thanks in advance all.

  2. So I suppose that I was just thinking about how to execute it incorrectly. From what the indomitable Mitchell has said, I reworked it so that my request to open a view fired an application event instead, which was handled by an event handler in the controller that reloaded the store and then opened the view once that was complete (via the callback on store.load()).

    It seems that there isn't a way to do this as I was thinking earlier. Thanks Mitchell.

Posting Permissions

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