1
以下是我的表單定義,裏面我想分配項的值屬性來自json文件,它具有關於fieldLabel,name,xtype等的信息。那麼有什麼辦法可以做到這一點?EXTJS:如何從JSON文件加載Ext.form.panel項目配置
Ext.define('com.myproject.view.myform', {
extend:'Ext.form.Panel',
alias: 'widget.myform',
xtype : 'myform',
autoShow : true,
width: 500,
height: 400,
title: 'Foo',
floating: true,
closable : true,
items: [{
fieldLabel: 'ID',
name: 'filterID',
xtype : 'textfield',
allowBlank: false
},{
fieldLabel: 'LABEL',
name: 'filterLabel',
xtype : 'textfield',
allowBlank: false
}] });
JSON文件
{"itemsConfiguration": [{
"fieldLabel": "ID",
"name": "filterID",
"xtype" : "textfield",
"allowBlank": false
},{
"fieldLabel": "LABEL",
"name": "filterLabel",
"xtype" : "textfield",
"allowBlank": "false"
}]}