问题
I am using cell editing plugin for editing a cell. But it is like when we click that colunm it will move to edit mode. I want to show complete column with editable text box.
Currently I am using following code to make it editable.
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
columns: [
{ text: ... },
{ text: ... },
{ text: ... },
{ text: 'TText', flex: 1, dataIndex: 'TText',
editor: {
xtype: 'textfield',
allowBlank: false
}
}
]
回答1:
I think this will work good enough for your scenario:
columns: [
{ text: ... },
{ text: ... },
{ text: ... },
{ text: 'TText', flex: 1, dataIndex: 'TText',
editor: {
xtype: 'textfield',
allowBlank: false
},
renderer: function(value, metaData){
metaData.style = "border: 1px gray solid;";
return value;
}
}
]
回答2:
Wait for the beforeedit
event and then
... Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
beforeedit: function( oEditor, oOptions ) {
// for each record start the edit mode 'startEdit()'
}
}
Check the doc: startEdit()
来源:https://stackoverflow.com/questions/17300967/how-to-show-complete-column-as-editable-in-extjs-gridcell-editing