PDA

View Full Version : Example of dynamic view creation and deletion?



mchev2
16 Feb 2011, 3:32 PM
Hi there,

I've been working on an app, which has a lot of dynamic nested data. I created a nested view. In the controller, I'm deleting the previously created instance of this view, and recreating it with new data. But, when I recreate it, the toolbar back button appear twice. Are there any examples of creating and deleting components dynamically. Here is my code snippet.



app.controllers.section = new Ext.Controller({
index: function(options){
console.log('Section start');
switch(options.id)
{
case 0:

break;
}

if(app.views.section)
{
app.views.viewport.remove(app.views.section);
Ext.destroy(app.views.section);
}

Ext.apply(app.views,{
section: new app.views.Section(),
});

app.views.viewport.add(app.views.section);

app.views.viewport.setActiveItem(app.views.section);

},
});