我有一些商店,它是数据。在面板上,它看起来如何“ fieldName”和文本字段(与调用的形式有所不同)。例如,在一种形式上显示“名称文档”和字段,在另一种形式上显示:销售日期和日期字段。数据是动态形成的
这是商店:
var someStore = new Ext.data.JsonStore({
storeId: 'myStore',
url: objectUrlAddress,
baseParams: {
'objectID' : objectID
},
root: 'Fields',
fields: [
{name: 'Hint'},
{name:'Type', type: 'int'},
{name: 'Value'},
{name: 'Index', type: 'int'},
{name: 'IsRequired', type:'bool'},
{name: 'Identifier'},
{name: 'EnumList'},
{name: 'Directory'},
{name: 'Data'}
]
});
这里是网格:
var mainGrid = new Ext.grid.EditorGridPanel({
id: 'tableId',
height:300,
width: '100%',
frame: true,
store: someStore,
columns:
[{header: 'Объект', width:200, dataIndex: 'Hint'},
{header: 'Значение', dataIndex: 'Value', width:300, editor: {xtype: 'textfield'},
getEditor: function(record) {
var xtype = 'textfield',
args = {
fieldLabel: 'Hint',
allowBlank: 'IsRequired',
value: 'Data',
disabled: false
};
switch ('Type') {
case 0: // int
xtype = 'numberfield';
args.allowDecimals = false;
break;
case 1: // decimal
xtype = 'numberfield';
args.allowDecimals = true;
break;
case 2: // text
xtype = 'textfield';
break;
case 3: // date
xtype = 'textfield';
args.emptyText = 'дд.мм.гггг чч:мм';
args.format = 'd.m.y H:i';
break;
case 4: // enum
case 5: // sql
var dataValues = Ext.util.JSON.decode('Enumlist');
var dataArray = Object.keys(dataValues).map(function(k) { return [k, dataValues[k]] });
xtype = 'combo ';
args.store = new Ext.data.ArrayStore({
fields: [
{name: 'myId', type: 'string'},
{name: 'displayText'}
],
data: dataArray
});
break;
}
return new Ext.grid.CellEditor ({
field: Ext.create(xtype, args)
});
}
}]
});
但是我在这里出现错误“ TypeError:b [(中间值)]不是构造函数”
field: Ext.create(xtype, args)
我如何解决此问题?请帮忙!