开发者

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'
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜