1

In a dataview I change on "painted"-event the width and height of some dom-elements. That works, sometimes. Sometimes the new values are overwritten with the definitions of the CSS file.

setOverviewImages: function( e , element ) { // called after "painted" event

    var overview = this.getMyoverviewView();
    var newWidth = parseInt(overview.element.getWidth() / 2 - 50);
    var overviewImages = Ext.select( '.myoverview-container' );

    overviewImages.each( function(el , c , index) {
        el.setSize( newWidth , newWidth );
    });
},

Which event fires when DOM is rendered?

Michael
  • 6,823
  • 11
  • 54
  • 84

1 Answers1

0

DOM should be ready when you handle "show" event

http://docs.sencha.com/touch/2-1/#!/api/Ext.dataview.DataView-event-show

If that's not what you want you can use initialize or activate also.

ThinkFloyd
  • 4,981
  • 6
  • 36
  • 56
  • 1
    Activate and initialize come too early, because I need the actual width of the view, and those return 0. show has the same effect as painted. It doesn't work sometimes ... I heard about problems with painted, that there DOM changes after. But they should not be. – Michael Dec 30 '12 at 11:22
  • If you don't find anything you like, you can use delayed task or defer function to change widths after few milli seconds http://docs.sencha.com/touch/2-1/#!/api/Ext-method-defer – ThinkFloyd Dec 30 '12 at 16:12