I started learning ExtJS recently.I created a grid with columns(names,email , phone) and added some dummy data using store. Here column -("names") is editable column. when user sees that grid , he should come to know that (names) column is editable. For this I needed to add edit symbol( iconCls: 'fa fa-edit' fontawesome) to the right side of data in each column under "names" header,so that user can come to know that that column is editable.How can I achieve this.Please help me with this,I tried a lot but did not found a solution.Thanks in advance.
ExtJS grid code:
Ext.define('FirstApp.view.main.List', { extend: 'Ext.grid.Panel', xtype: 'mainlist', columnLines: true,
requires: [
'FirstApp.store.Personnel',
'Ext.grid.filters.Filters'
],
title: 'Personnel',
collapsible: true,
iconCls: 'icon-grid',
frame: true,
width: 700,
height: 500,
resizable: true,
plugins: 'gridfilters',
emptyText: 'No Matching Records',
loadMask: true,
stateful: true,
stateId: 'stateful-filter-grid',
store: {
type: 'personnel',
autoLoad: true,
autoDestroy: true
},
tbar: [{
text: 'Show Filters...',
tooltip: 'Show filter data for the store',
handler: 'onShowFilters'
}, {
text: 'Clear Filters',
tooltip: 'Clear all filters',
handler: 'onClearFilters'
}],
columns: [
{ text: 'Name', dataIndex: 'name',flex:1,
align: 'center',
editor: {
xtype: 'textfield',
allowBlank: false
},
filter: {
type: 'string',
itemDefaults: {
emptyText: 'Search for...'
} }},
{ text: 'Email', dataIndex: 'email', flex: 1,filter: {
type: 'string',
itemDefaults: {
emptyText: 'Search for...'
} }},
{ text: 'Phone', dataIndex: 'phone', flex: 1 }
],
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
]
});
refer Grid image with arrowd indication where that editable fontawesome should appear
I found solution for this problem.
To which column we want to add edit image on the rightside of data it gets from store,so as to indicate that it is a editable column. 1). make the column firstly as "widgetcolumn" and make the changes in grid as follows:
//grid column code example:
2). changes in css file to change color of button
3). refer image of grid after changes