sencha touch add child at a later time
say I make a container with an id of "my-container". I'm going to load data via JSONP so how would I add more objects to "my-container" in a call back?
callback:function(data) {
Ext.get('my-container').add([some object]);
Ext.get('my-container').appendChild([some object]);
Ext.get('my-container').i开发者_如何学Gotems = [some object];
}
I've tried those with no avail.
var myContainer = new Ext.Container({
// stuff
})
Ext.util.JSONP.request({
// needed stuff
callback:function(data) {
myContainer.add([Some Object])
myContainer.doLayout();
}
}
and viola.
-- better answer --
new Ext.Container({
renderTo:Ext.getBody(),
id:'parent-id'
});
new Ext.Container({
renderTo:'parent-id'
})
精彩评论