PDA

View Full Version : icon shows in the Grid



Fonnit
24 Sep 2012, 6:43 PM
Hi all,

I want to know whether it is possible to add a icon/text into the first cell that the row number is displayed
when i add or edit the row. The grid likes the one below.
38903

Thanks...

redraid
24 Sep 2012, 11:45 PM
Try this


{
text: "&#160",
width: 40,
sortable: false,
draggable: false,
autoLock: true,
lockable: false,
align: 'right',
resizable: false,
hideable: false,
menuDisabled: true,
dataIndex: '',
cls: Ext.baseCSSPrefix + 'row-numberer',
rowspan: undefined,
renderer: function(value, metaData, record, rowIdx, colIdx, store) {
var rowspan = this.rowspan,
showIcon = record.phantom || record.dirty,
icon;

if (rowspan){
metaData.tdAttr = 'rowspan="' + rowspan + '"';
}

metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';

if (showIcon) {
icon = record.phantom ? 'new.png' : 'edit.png';
return '<img src="' + icon + '" alt="' + icon + '">&nbsp;' + (store.indexOfTotal(record) + 1);
}

return store.indexOfTotal(record) + 1;
}
},