如何解决EXT JS模板由几部分组成
| 如何创建具有较小零件的表单面板。较小的部分应可在模板中重复使用。解决方法
我为此使用助手。这是一个应该向您展示技巧的示例。
/// limitForm : array with all ellemts that should be taken from the inner form. can be null or empty to take all
FormContent.loginForm = function (limitForm) {
var defaults = [
{/* this has the ID 0 */
xtype: \'Fieldset\',title: \'Username\',layout: \'form\',items: [
{
xtype: \'panel\',header: false,hideBorders: true,bodyBorder: false,border: false,height: 40,items: [
{
xtype: \'textfield\',fieldLabel: \'Username\',regex: /^[\\w\\s\\.]*$/,regexText: \'No special chars allowed in this field\',anchor: \'100%\',name: \'LoginName\'
}
]
}
]
},{/* this has the ID 1 */
xtype: \'Fieldset\',title: \'Additional data\',items: [
{
xtype: \'panel\',layout: \'column\',items: [
{
xtype: \'panel\',columnWidth: 0.5,items: [
{
xtype: \'textfield\',fieldLabel: \'Title\',name: \'Title\'
}
]
},{
xtype: \'panel\',style: \'margin-left: 18px\',hideBorders: false,labelWidth: 65,name: \'Title\'
}
]
}
]
}
}
];
if (limitForm) {
var ds = [];
for (var i = 0,len = limitForm.length; i < len; i++) {
ds.push(defaults[limitForm[i]]);
}
defaults = ds;
}
return defaults;
}
如果要重用它,则可以使用配置数组或字段名称修改函数参数(名称必须更改,否则将只提交一个字段)。但是我认为它应该向您显示窍门。
可以肯定的是,这是在主窗体中加载的!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。