PDA

View Full Version : Troubles with Grid Plugins - Expander v3.2



igor2000
29 Nov 2010, 3:25 AM
Hi, I want to do something like the Grid Plugins Example in my GridPanel (wich is already working)

I just created the variable before the grid:



var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<p><b>Processos Apensados:</b> {NumProc}</p><br>'
)
});
//NumProc is one of the Grid's field

grid = new Ext.grid.GridPanel({ ...


and inserted the plugin:



height: 330,
width: 575,
plugins: expander,


But I got a js error:
"Mensagem: 'Ext.ux.grid.RowExpander' is null or not an object"

Did I do somthing wrong?

Thx

I am using Ext JS Library 3.2.1

Condor
29 Nov 2010, 3:57 AM
All Ext.ux.* classes are not included in ext-all.js and need to be included separately from examples/ux.

Don't forget that most ux'es also have their own css file that also needs to be linked.

igor2000
29 Nov 2010, 4:01 AM
ah ok, so I dont need to update my version, just link a file from examples/ux right?

igor2000
29 Nov 2010, 5:34 AM
OK, everything worked. But now I got a new problem:

This grid had colored rows:



// Create grid view
var gridView = new Ext.grid.GridView({
//forceFit: true,
getRowClass : function (row, index) {
var cls = '';
var data = row.data;
if (data.Situacao == 'RECENTE') {
iRecente += 1;
cls = 'laranja-row';
} else if (data.Status == 'Retornado') {
iVolta += 1;
cls = 'beje-row' ;
} else if (data.Situacao == 'RECEBER') {
iReceber += 1;
cls = 'blue-row';
} else if (data.Situacao == 'MOVIMENTAR') {
iMovimentar += 1;
cls = 'green-row';
} else if (data.Situacao == 'EXTERNO') {
cls = 'blue-row' ;
} else if (data.Situacao == 'ENCAMINHAR') {
iEncaminhar += 1;
cls = 'red-row' ;
} else {
iNormal += 1;
}

return cls;
}
}); //end gridView




However after I implemented the plugin its colors disapeared...

Condor
29 Nov 2010, 5:43 AM
Use:

var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<p><b>Processos Apensados:</b> {NumProc}</p><br>'
),
getRowClass : function(record, rowIndex){
var cls = ...; // your code here
return this.constructor.prototype.getRowClass.apply(this, arguments) + ' ' + cls;
}
});

igor2000
29 Nov 2010, 5:48 AM
perfect!! thx man