Extjs RowExPander - NextBd è NULL
Domanda
Ho problemi a configurare RowExPander per la mia griglia.Quando la griglia renda l'espansore è già aperta per ogni riga e senza nulla dentro.Quando clicco sulla sua icona viene generato il seguente errore: NextBD è NULL.Ho trovato un problema molto simile qui http://www.sencha.com/forum/showthread.php? 185837-18537-pannello-pannello-plugin-rowexpander-nextbd-is-null ma la soluzione non funziona per me e ancora non capisco perché plugin confignon può essere passato nel metodo InitComponent:
Ecco il mio codice griglia:
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);
},
. Soluzione
Il plugin rowexpander
utilizza una funzione chiamata rowbody
.
Nel initComponent()
si sovrascrive this.features
(che include già rowbody
) con questa linea:
this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
.
Quindi la funzione rowbody
non è inclusa;Quindi la classe .x-grid-rowbody-tr
non è iniettata;Così rowexpander
non riesce a trovare tale classe per nextBd
e restituisce NULL.
Dovresti provare:
var iNewFeatures = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
this.features = iNewFeatures.concat( this.features );
.
Infine, i plugin non possono essere avviati in InitComponent()
, è possibile dichiararli come configurazioni o all'interno del costruttore.Vedi Questo thread per maggiori informazioni.