PDA

View Full Version : Ext.ux.RowExpander: more than one expand column



ssamayoa
16 Jun 2011, 11:02 PM
Hi.

I have a very annoying problem with Ext.ux.RowExpander, let me explain:

I have an grid panel which is meant to be instantiated multiple times with its own store.

It works as expected but when I add the RowExpander plugin, each time I instantiate the panel grid I got another expand column: first istantiation = 1 expand column, second instantiation = 2 expand columns and so.

I looked at the pluing code and found that plugin allways add the column without checking if already exists. I modified the code so headerId of the plugin´s config is looked in the columns array and if is there dont create the column.

So far, this seems to work but each time I expand or collapse a record in 2d and further instances I get the following error:

Uncaught TypeError: Cannot read property 'internalId' of undefined

There is a plugin´s internal property called recordsExpanded which I dont understand what is for.

Some help here please.

Regards.

ssamayoa
16 Jun 2011, 11:17 PM
UPDATE:

If I close the first instance expand stop working on any other grid, this is the stack trace:

Uncaught TypeError: Cannot read property 'data' of null
Ext.define.getRecordAbstractView.js:629
Ext.define.toggleRowRowExpander.js:189
(anonymous function)ext-debug.js:2115
processEventRowExpander.js:232
Ext.define.processEventTable.js:726
fireext-debug.js:16320
Ext.define.fireEventObservable.js:266
Ext.override.fireEventEventBus.js:24
Ext.define.processItemEventTable.js:653
Ext.define.processUIEventView.js:446
Ext.define.handleEventView.js:385
anonymous:5
wrapext-debug.js:16885

It seems that I will pass my code from "Ext.define(...)" to instantiate the whole panel in code.

Regards.

ssamayoa
17 Jun 2011, 12:40 PM
UPDATE:

FWIW I finally do all the grid instatiation by code instead of Ext.define() / Ext.widget().

Now it works well, features / plugins alters the definition so all instances uses the same values / objects.

Now I want to show in the expanded row nested store but templates cant do that.

ExtJS MVC works well for "singleton" controllers, views and stores but I just realized that I'm gradually going to old model because the "singleton" nature of MVC.

Regards.

andy13c72back
28 Jun 2011, 6:18 AM
Great ssamayoa! I have the same problem with yours and I'm so mad of it. Would you mind post the detailed code here or send it to my email "andy13c72back@hotmail.com".

Great thanks in advance!

ssamayoa
28 Jun 2011, 6:43 AM
No much to say other than instead of Ext.define(...) I created a singleton class which does a Ext.create("Ext.grid.Panel", options) where options is stack var instead of "class" var:



crearXPeriodo : function(periodo) {
var store = Ext.create("pp.store.pago.Pagos", {
sorters : [ "empleadoCodigo" ]
});
store.getProxy().extraParams = {
periodoId : periodo.get("id")
};
var grid = Ext.create("Ext.grid.Panel", {
store : store,
loadMask : true,
columns : [ {
xtype : "actioncolumn",
width : 25,
align : "center",
items : [ {
// TODO: No funciona iconCls...
// iconCls : "det",
icon : "img/det16.png",
tooltip : "Conceptos",
handler : function(grid, ri, ci) {
GridPagos.mostrarConceptos(grid, grid.getStore().getAt(ri));
}
} ]
}, {
header : "Código",
dataIndex : "empleadoCodigo",
hideable : false
...
plugins : [ {
ptype : "rowexpander",
rowBodyTpl : this.detalleTpl,
expandOnDblClick : false
} ],
listeners : {
beforerender : function(me) {
me.store.load();
}
}
});
return grid;
},



Regards.