PDA

View Full Version : How to display Conditional RowExpander in grid using EXTJS4.2



wellsfargouser
6 Mar 2014, 9:54 AM
How to display Conditional RowExpander in grid using EXTJS4.2

I have overriden row expander plugin with below code.
From below code, I see issue at <evalExpander method>, not able to get Cell object from Store record.

Check this fiddle- only working for EXTJS4.1.0 docs.

Please correct this fiddle to work for EXTJS4.2. docs as well
http://jsfiddle.net/prajavk/p5d9H/


Code :
init: function (grid) {
var me = this;
me.grid = grid;
me.callParent(arguments);
grid.on('viewready', me.evalExpander, me);
grid.getStore().on('datachanged', me.evalExpander, me);
},

/*
* @method
* evaluate row expander style based on valid column value
*/
evalExpander: function () {
var me = this;
var grid = me.grid;
var cell, ex;

//TODO - Please check this logic not working with EXTJS4.2 docs
grid.getStore().each(function (rec) {
cell = grid.view.getCell(rec, grid.down('headercontainer').items.getAt(0));
ex = Ext.get(cell).down('.' + Ext.baseCSSPrefix + 'grid-row-expander');
if (true) {
ex.removeCls(Ext.baseCSSPrefix + 'grid-row-expander');
}
});
}

scottmartin
6 Mar 2014, 10:28 AM
Have you tried placing a breakpoint in the function to see where the problem is?

If you breakdown this call, you will get a better view:


cell = grid.view.getCell(rec, grid.down('headercontainer').items.getAt(0));

wellsfargouser
6 Mar 2014, 10:50 AM
I tried this breakdown this, no clue how to get Cell object using EXTJS4.2 docs

cell = grid.view.getCell(rec, grid.down('headercontainer').items.getAt(0));

Can you help to breakdown this logic.