How to show complete column as editable in extjs grid(cell editing)?

橙三吉。 提交于 2019-12-11 02:14:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!