我有一个问题,使我的网格中只有一列可编辑。我的相关网格配置是:
me.FeatureGrid = me.add({
xtype: 'rallygrid',
width: 700,
height:300,
scroll:'vertical',
columnCfgs: [
{
text:'Feature',
dataIndex:'Name',
width:400
},{
text:'Stories',
dataIndex:'ObjectID',
sortable:true,
doSort: function(direction){
//custom sort function
},
width:100,
renderer:function(oid){
//custom render funciton
}
},{
dataIndex:'My_Custom_Field',
width:180,
text:'Status',
editor:{
xtype:'combobox',
store: Ext.create('Ext.data.Store', {
fields: ['Status'],
data:[
{'Status':'Committed'},
{'Status':'Not Committed'}
]
}),
editable: false,
displayField: 'Status'
},
renderer: function(tcs, meta, record){
//render function
}
}
],
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit:1
})
],
viewConfig:{
stripeRows:true
},
listeners: {
beforeedit: function(editor, e){
console.log(e.colIdx);
return e.colIdx === 3; //only edit last col
},
edit: function(editor, e){
//edit function
}
},
showPagingToolbar:false,
enableEditing:false,
context: this.getContext(),
store: //feature Store
});
我试图只让第 3 列 (My_Custom_Field) 可编辑,因此用户无法更改第 1 列和第 2 列中的任何内容。此外,第 3 列有一个组合框,只有 2 个值可供选择,所以我必须设置它到不可编辑。我的目标是用户更新组合框,然后触发“编辑”事件并保存更新的记录。
我的第一个问题是我不想在行的开头出现“编辑记录齿轮”,但由于我添加了插件,它不会消失。就像我说的,我只希望用户可以编辑第三列。
此外,当我完成单击组合框并选择值时,我得到了一些奇怪的错误。这是错误的堆栈跟踪,我不知道null
我的网格中有什么。