ExtJS RowExpander - nextBd es nulo
Pregunta
Tengo problemas al configurar RowExpander para mi grilla.Cuando se representa la cuadrícula, el expansor ya está abierto para cada fila y sin nada dentro.Cuando hago clic en su icono se genera el siguiente error:nextBd es nulo.Encontré un problema muy similar aquí. http://www.sencha.com/forum/showthread.php?185837-Grid-Panel-PlugIn-Rowexpander-nextBd-is-null pero la solución no funciona para mí y todavía no entiendo por qué la configuración del complemento no se puede pasar en el método initComponent:
Aquí está mi código de red:
Ext.define('GSIP.view.plans.PlanReqList' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.gsip_devplan_list',
id: 'gsip_plan_list',
plugins: [{
ptype: 'rowexpander',
rowBodyTpl : [
'Nazwa:{name}'
]
}],
//title:i18n.getMsg('gsip.view.PlanReqList.title'),
layout: 'fit',
initComponent: function() {
this.store = 'DevPlan';
// this.plugins = [{
// ptype: 'rowexpander',
// rowBodyTpl : [
// {name}
// ]
// }];
this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
this.tbar = [{
xtype:'commandbutton',
id: 'newReq',
iconCls:'icon-application_add',
text: i18n.getMsg('gsip.view.plans.PlanReqList.addReq'),
command: 'newReq',
}];
this.viewConfig = {
forceFit:true,
getRowClass: function(record, index) {
var c = record.get('elapsedPercent');
if (c >= 0) {
return 'elapsed-normal';
}
}
}
this.columns = [
{header: "Id", dataIndex: "id", width:50, sortable: true, filter:{type:'numeric'}},
{header: i18n.getMsg('gsip.view.plans.PlanReqList.column.name'), dataIndex: "name", flex:1, sortable: true, filter:{type:'string'} },
}
];
this.callParent(arguments);
},
Solución
El rowexpander
El complemento hace uso de una función llamada rowbody
.
En tus initComponent()
tu anulas this.features
(que ya incluye rowbody
) con esta línea:
this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
Por lo tanto, la rowbody
la característica no está incluida;Por lo tanto, la .x-grid-rowbody-tr
la clase no se inyecta;de este modo rowexpander
no puedo encontrar esa clase para nextBd
y devuelve nulo.
Deberías intentarlo:
var iNewFeatures = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
this.features = iNewFeatures.concat( this.features );
Por último, los complementos no se pueden iniciar en InitComponent()
, puedes declararlos como configuraciones o dentro del constructor.Ver este hilo para más información.