cordovasencha-touchdatalistsencha-touch-2.3

Sencha Touch: Any event which is fired after List Items have been rendered


Simple problem but I haven't managed to find a possible solution:

I have a list in Sencha Touch with Items generated through the itemTpl property. Now I want to go through the items (after they were rendered!) in the DOM and Replace their images (using imgCache for on-device-caching of images)

The Painted event of the List doesn't help because it's fired before the Item-DOM is rendered.

EDIT: My current solution is to override the internal updateListItem method of the Ext.dataview.List, call the original updateListItem there and add there my additional functionality. Still looking for a better solution ...


Solution

  • The list associated store's load event is what you're looking for.

    [EDIT]

    As you point out in the comments the load event is not guaranteed to be thrown after the items have actually been rendered.

    I think your approach is correct, but instead of adding in place your functionality, why don't you fire a custom event at the end of the overridden method, passing the list item itself, so that you can listen for that event on the list?

    Something like:

    updateListItem: function(item, index, info) {
    
        // function body ...
    
        me.fireEvent('listitemupdate', [item, index]);
    
    }
    

    That should keep your code a little more clean and reusable.