Set Cell ID in ExtJS 4 Grid

I am transferring a rather large chunk of old HTML code to the ExtJS 4 grid and stumbled upon the following problem: I want to be able to set a user ID for TD elements in the grid. As far as I understand, I need to override the default template used to create cells. My current template is as follows:

    Ext.view.TableChunker.metaRowTpl = [
   '<tr class="' + Ext.baseCSSPrefix + 'grid-row {addlSelector} {[this.embedRowCls()]}" {[this.embedRowAttr()]}>',
    '<tpl for="columns">',
     '<td class="{cls} ' + Ext.baseCSSPrefix + 'grid-cell ' + Ext.baseCSSPrefix + 'grid-cell-{columnId} {{id}-modified} {{id}-tdCls} {[this.firstOrLastCls(xindex, xcount)]}" {{id}-tdAttr}><div class="' + Ext.baseCSSPrefix + 'grid-cell-inner ' + Ext.baseCSSPrefix + 'unselectable" style="{{id}-style}; text-align: {align};">{{id}}</div></td>',
    '</tpl>',
   '</tr>'
  ];

What placeholder can be used to be able to manipulate the id = attribute of a table table?

+3
source share
2 answers

Do not overwrite tpl, just set your own renderer column , which will update the column metadata:

columns: [{
    text: 'Blah',
    dataIndex: 'blah',

    renderer: function(value, metaData, record) {
        metaData.tdAttr = 'id="someprefix-' + record.get('blah') + '"';
        return value;
    }
}, ... ]
+8
source

The 1st answer worked fine for me, and removing id was easy:

oncellclick:function(grid, row, col, e){
        alert( row['id'])
    }
0
source