ExtJS RowExpander-nextBd为null
题
我在为我的网格配置RowExpander时遇到问题。当网格渲染时,扩展器已经为每行打开,并且内部没有任何内容。当我点击它的图标时,会生成以下错误:nextBd为null。我在这里发现了非常类似的问题 http://www.sencha.com/forum/showthread.php?185837-Grid-Panel-PlugIn-Rowexpander-nextBd-is-null 但是解决方案不适合我,仍然不明白为什么插件配置不能在initComponent方法中传递:
这是我的网格代码:
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);
},
解决方案
该 rowexpander
插件使用了一个名为 rowbody
.
在你的 initComponent()
你复盖 this.features
(其中已经包括 rowbody
)用这条线:
this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
因此, rowbody
功能不包括在内;因此, .x-grid-rowbody-tr
类未注入;因此 rowexpander
找不到这样的课程 nextBd
并返回null。
你应该试试:
var iNewFeatures = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
this.features = iNewFeatures.concat( this.features );
最后,插件不能在 InitComponent()
, ,您可以将它们声明为configs,也可以在构造函数中声明。见 这个线程 了解更多信息。
不隶属于 StackOverflow