Romick
24 Jan 2012, 7:27 AM
Hi!
I couldn't find a solution for making grid rows background-color that is fetched from the store.
I have tied:
viewConfig: {
getRowClass: function(record, rowIndex, rowParams, store){
rowParams.tstyle += "background-color:" + record.data.color + ';'; //deprecated
this.getRow(rowIndex).style.backgroundColor = 'Yellow';
Ext.fly(this.getRow(rowIndex).style.backgroundColor = 'Yellow');
return Ext.String.format('" style="background-color:{0} !important;', record.data.color);
//this makes <tr class="x-grid-row" style="background-color:#B0E0E8 !important;">, but it not work i dont know why
}
I even tried:
features: [
Ext.create('Ext.grid.feature.RowBody', {
getAdditionalData: function(data, rowIndex, record, orig) {
var headerCt = this.view.headerCt,
colspan = headerCt.getColumnCount();
return {
rowBody: "",
rowBodyCls: this.rowBodyCls,
rowBodyColspan: colspan
}
}
})
],
But i dont know how to use it.
However:
renderer: function (val, metadata, record, rowIndex){
metadata.style = 'background-color:'+record.data.color+';';
metadata.tdAttr = 'style="background: '+record.data.color +'"';
//this.getView().getRow(rowIndex).style.backgroundColor='Yellow';
return '';
},
Work fine but it is only for one columns. Shoud i add the same color renderer to each column?
To fix the row background color.
I couldn't find a solution for making grid rows background-color that is fetched from the store.
I have tied:
viewConfig: {
getRowClass: function(record, rowIndex, rowParams, store){
rowParams.tstyle += "background-color:" + record.data.color + ';'; //deprecated
this.getRow(rowIndex).style.backgroundColor = 'Yellow';
Ext.fly(this.getRow(rowIndex).style.backgroundColor = 'Yellow');
return Ext.String.format('" style="background-color:{0} !important;', record.data.color);
//this makes <tr class="x-grid-row" style="background-color:#B0E0E8 !important;">, but it not work i dont know why
}
I even tried:
features: [
Ext.create('Ext.grid.feature.RowBody', {
getAdditionalData: function(data, rowIndex, record, orig) {
var headerCt = this.view.headerCt,
colspan = headerCt.getColumnCount();
return {
rowBody: "",
rowBodyCls: this.rowBodyCls,
rowBodyColspan: colspan
}
}
})
],
But i dont know how to use it.
However:
renderer: function (val, metadata, record, rowIndex){
metadata.style = 'background-color:'+record.data.color+';';
metadata.tdAttr = 'style="background: '+record.data.color +'"';
//this.getView().getRow(rowIndex).style.backgroundColor='Yellow';
return '';
},
Work fine but it is only for one columns. Shoud i add the same color renderer to each column?
To fix the row background color.