Sencha触摸动态构建表单面板

sencha touch build formpanel dynamically

本文关键字:表单 构建 触摸 动态 Sencha      更新时间:2023-09-26

我是sencha touch的新手我想创建一个formPanel后,用户单击一些监听器,我发现如何收听一个项目,但问题是创建一个页面,并填写来自JsonP请求的数据I tried

Ext.data.JsonP.request({
url: 'url',
callbackName: 'callback1',
success: function(result, request) {

 Ext.Viewport.add({     
    title : 'Category',
    iconCls : 'home',
    id:'category'+id,
    xtype : 'formpanel',  
    deferredRender:true,
    tabBarPosition : 'bottom',
    data:result.prop
}); }});

在控制台中,没有错误,表单添加但不在已经存在的formpanel中

您可以尝试下面的示例代码。

onButtonClick: function(button) {
Ext.data.JsonP.request({
url: 'url',
callbackName: 'callback1',
success: function(result, request) {

 button.up('some_id').add({     
    title : 'Category',
    iconCls : 'home',
    id:'category'+id,
    xtype : 'formpanel',  
    deferredRender:true,
    tabBarPosition : 'bottom',
    data:result.prop
 }); 
}});
}