View Full Version : Re-Render after destroy

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(){

// Show the ActionSheet

// ...after choosing an option, we want to show the ActionSheet again

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

[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/

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({...});