3
如何添加属性网格内的列?到目前为止,我已经试过如下:Ext.js将列添加到属性网格
source : dataForGrid.source,
columns : [
{
text: 'text',
xtype : 'checkcolumn',
dataIndex : 'status',
width : 100,
editor : {
xtype : 'checkbox'
},
listeners : {
checkchange : function (checkColumn, rowIndex, checked, eOpts) {
//some code here
}
},
renderer: function(val, m, rec, rowIndex) {
//some code here
}
},
{
text: 'TEST',
sortable: false,
dataIndex: 'value2',
field: {
xtype: 'textfield'
}
}
],
customEditors: dataForGrid.customEditors,
我的来源是非常标准的,我有一个TEMPOBJ女巫持有以下特性(dataForGrid被传递到电网的来源属性):
tempObj.name = data[i].some;
tempObj.text = data[i].some === '' ? '' : '<a class="clientNameTextSomeGrid" onclick="console.log(123)">' + data[i].some + '</a>';
tempObj.editor = data[i].someother;
tempObj.datatype = 'nvarchar';
tempObj.editable = true;
tempObj.status = data[i].someother === 'A' ? true : false;
tempObj.renderer = "";
tempObj.value2 = "gcgrg";
dataForGrid.source.push(tempObj);
,我有一个customEditors:
var newField = Ext.create('Ext.form.ComboBox', {
name: data[i].some,
store: tempStore,
clientID: tempObj.editor,
queryMode: 'local',
editable: false,
displayField: 'value',
valueField: 'id',
triggerAction: 'all'
});
dataForGrid.customEditors[data[i].some] = new Ext.grid.CellEditor({
field: newField
});
复选框(和使用customEditors组合框)工作正常。但是我无法为'TEST'列添加值(该列出现但没有值)。任何帮助将不胜感激。如果您有任何问题或需要更多代码,请在下面写下评论并提供。
* UPDATE:如果我的第二列的dataIndex属性保存的是“状态”的值(从TEMPOBJ),列呈现与具体数值,但如果我再次,使用Value 2属性从TEMPOBJ列保持空白。
有趣的问题,只有改善将是一个的jsfiddle – roo2