PDA

View Full Version : Re-Render after destroy



schtono
28 Jul 2011, 3:39 AM
Hi guys, I'm pulling my hair on this one, suppose it's piece of cake for you:

I have an ActionSheet that needs to be destroyed after its first use (reason is irrelevant for now, see [1]).
If I have to use the same ActionSheet for a second time, how can I tell Sencha Touch to rerender the item? Using the show() method after destroying the ActionSheet in the first place does not "re-render" it.


// Instantiate an ActionSheet
var as = new Ext.ActionSheet({
items: [...]
handler: function(){
as.hide();
as.destroy();
}
});

// Show the ActionSheet
as.show();

// ...after choosing an option, we want to show the ActionSheet again
as.show();

// TypeError: Result of expression 'el' [undefined] is not an object.Would be cool if some could help out here.
THANKS!!!


[1] The ActionSheet needs to be destroyed to avoid a serious display bug after orientationchange, see here: http://www.sparky-san.com/rendering-issues-sencha-touch-caused-ext-sheet/

mitchellsimoens
28 Jul 2011, 5:22 AM
What I would do if you destroy things (which I would recommend to keep things clean) is that in your handler, you check to see if it is created. If not create it, if so then show it.


function() {
var me = this,
sheet = me.actionSheet;

if (!sheet) {
sheet = me.actionSheet = new Ext.Ext.ActionSheet({...});
}

sheet.show();
}