Per Sencha documentation, numbercolumn, datecolumn and booleancolumn does not have a renderer event. As logical as this sounds there is an inherent issue with not having a renderer event on these column types.
Example of a renderer function in a view controller to modify the background color when the LineNum of the record is in the array of warning line numbers.
renderCompanyID: function(value, metaData, record, rowIndex, colIndex, store, view) {
if (record.get('LineNum') > 0) {
this.warningLineArr.forEach( function (item, index){
if (item['LineNum'] == record.get('LineNum')) {
metaData.style = "background-color: rgba(255, 184, 77, 0.25);";
view.addRowCls(rowIndex, 'rec-warn');
}
});
}
},
And the renderer in a gridcolumn definition is as follows
xtype: 'gridcolumn',
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
Ext.fireEvent('renderCompanyID', value, metaData, record, rowIndex, colIndex, store, view);
return value;
},
dataIndex: 'CompanyID',
text: 'Company ID'
And the results of this due to not having a renderer option on number and date columns is as follows:
So the question is, is there an event, listener or attribute on number, date or boolean columns that would send the metaData to the handler whereby the metaData can be altered on conditions and a per row/cell basis?
Your question may be an XY question, so let me answer your underlying problem first.
If it's just line numbers, you wouldn't use the
meta
parameter of therenderer
function.Since your color is fixed, it's even more easy to use the
getRowClass
method like this:and then you would define a CSS class with the color:
Relevant fiddle which also contains an answer to your question in the first place. Just in case you need it elsewhere on a single cell, it has the following override which updates meta info of a cell while using the default renderer: