PDA

View Full Version : getRowClass removes gridpanel rows completely



quintenvk
7 May 2013, 6:36 AM
I currently define an Ext.grid.GridPanel component where I'm applying the following viewConfig in the constructor of the defined component:



this.viewConfig = {
getRowClass : function (row, index) {
return 'row-error'; //should be conditional in production, of course
}
};


The problem is that, if i use this function, no rows are displayed. They aren't even present in the <tbody>-tag in the HTML.

When I try the following, all rows are normal:

this.viewConfig = {};

Can anyone explain what i'm doing wrong? I don't have any css defined for this so far, but surely that shouldn't matter as the html elements should at least be present in the source?

quintenvk
7 May 2013, 7:19 AM
Fixed, the problem was in ext3-compat.js. Anyone who bumps into this problem, the error is on line 973, see this code:


this.getRowClass = function(rec, rowIndex, rowParams, store){
var result = this.__getRowClass(rec, rowIndex, rowParams, store);
if (rowParams && rowParams.body) {
delete rowParams.body;
breaking({pkg:'Ext.grid.View', member:'getRowClass.rowParams.body', single:true,
msg:'To implement a custom row body you must add the RowBody feature (ftype:"rowbody") '+
'to the grid\'s viewConfig and override the "getAdditionalData" template method '+
'(or use the Ext.grid.RowBodyPlugin helper class). Unfortunately this cannot be '+
'inferred at design time so it must be fixed manually.'});
}
if (rowParams && rowParams.bodyStyle) {
delete rowParams.bodyStyle;
deprecate({pkg:'Ext.grid.View', member:'getRowClass.rowParams.bodyStyle', single:true,
msg:'To implement custom row styles you must add the RowBody feature (ftype:"rowbody") '+
'to the grid\'s viewConfig and override the "getAdditionalData" template method '+
'(or use the Ext.grid.RowBodyPlugin helper class). Note that in 3.x this property '+
'was a CSS style spec, whereas now you specify "rowBodyCls" as a CSS classname instead. Ignoring for now.'});
}
if (rowParams && rowParams.tstyle) {
delete rowParams.tstyle;
deprecate({pkg:'Ext.grid.View', member:'getRowClass.rowParams.tstyle', single:true,
msg:'Grid row bodies no longer use a wrapping TABLE element, so the "tstyle" property '+
'no longer directly applies. If you have CSS styles that still need to be applied, you '+
'should add the RowBody feature (ftype:"rowbody") to the grid\'s viewConfig and override '+
'the "getAdditionalData" template method (or use the Ext.grid.RowBodyPlugin helper class). '+
'Note that in 3.x this property was a CSS style spec, whereas now you would use the "rowBodyCls" '+
'CSS classname instead (and adjust for the fact that there is no TABLE if needed). Ignoring for now.'});
}
return result;
};