PDA

View Full Version : RowExpander + viewConfig doesnt work...



clemence
27 May 2010, 8:06 AM
I have a grid wich use the rowexpander plugin and i want to use the viewConfig attribute to put in color one row. But it doesnt work. Could you help me?


// row expander (custom expander)
var customExp = new Ext.grid.RowExpander({
tpl : new Ext.Template(
'<p></p>'
)
});

Grid= new Ext.grid.GridPanel({
title:'Liste',
ds: DataStore,
cm: cm,
enableColLock: false,
plugins: [customExp],
stripeRows :true,
viewConfig: {
getRowClass: function(record, rowIndex, rp, ds){ // rp = rowParams
//try
}...

jcfearon
2 Sep 2010, 11:53 AM
I'm hitting the same problems. Did you find a solution?

clemence
2 Sep 2010, 11:16 PM
i've no solution

jbraband
9 Sep 2010, 8:00 AM
the problem is that RowExpander defines and uses its own getRowClass method. you'll need to override it in the config object passed to the new instance of RowExpander. modifying your sample code, it'll look something like this:



// row expander (custom expander)
var customExp = new Ext.grid.RowExpander({
tpl : new Ext.Template(
'<p></p>'
)
,getRowClass: function(record, rowIndex, rp, ds){
return 'my-custom-css-class';
}
});

Grid= new Ext.grid.GridPanel({
plugins: [customExp],
.....
});


additionally, overriding the getRowClass method will not execute the RowExpander's default getRowClass implementation. therefore, its suggested to copy/pase the code inside RowExpander.getRowClass into your override. RowExpander's default getRowClass is what manages the expanded/collapsed css classes of the row body.This post talks about the conflict more: http://www.sencha.com/forum/showthread.php?12681-conflicted-getRowClass()-at-RowExpander&p=61948

whether or not you need to do this depends on the behavior you are expecting.

-j

jbraband
9 Sep 2010, 8:01 AM
the problem is that RowExpander defines and uses its own getRowClass method. you'll need to override it in the config object passed to the new instance of RowExpander. modifying your sample code, it'll look something like this:



// row expander (custom expander)
var customExp = new Ext.grid.RowExpander({
tpl : new Ext.Template(
'<p></p>'
)
,getRowClass: function(record, rowIndex, rp, ds){
return 'my-custom-css-class';
}
});

Grid= new Ext.grid.GridPanel({
plugins: [customExp],
.....
});


additionally, overriding the getRowClass method will not execute the RowExpander's default getRowClass implementation. therefore, its suggested to copy/pase the code inside RowExpander.getRowClass into your override. RowExpander's default getRowClass is what manages the expanded/collapsed css classes of the row body.This post talks about the conflict more: http://www.sencha.com/forum/showthread.php?12681-conflicted-getRowClass()-at-RowExpander&p=61948

whether or not you need to do this depends on the behavior you are expecting.

-j