ExtJS RowExpander-nextBd为空 [英] ExtJS RowExpander - nextBd is null
问题描述
我在为网格配置RowExpander时遇到问题.网格渲染时,扩展器已经为每一行打开,并且内部没有任何内容.当我单击其图标时,将产生以下错误:nextBd为null.我在这里 http发现了非常类似的问题://www.sencha.com/forum/showthread.php?185837-Grid-Panel-PlugIn-Rowexpander-nextBd-is-null ,但是该解决方案对我不起作用,仍然无法理解为什么插件配置无法在initComponent方法中传递:
I have problem configuring RowExpander for my grid. When the grid renders the expander is already opened for each row and with nothing inside. When i click on its icon the following error is generated: nextBd is null. I found very similar problem here http://www.sencha.com/forum/showthread.php?185837-Grid-Panel-PlugIn-Rowexpander-nextBd-is-null but the solution does not work for me and still dont get it why plugin config cannot be passed in initComponent method:
这是我的网格代码:
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
的功能.
The rowexpander
plugin makes use of a feature called rowbody
.
在您的initComponent()
中,您可以用以下行覆盖this.features
(已经包含rowbody
):
In your initComponent()
you override this.features
(which already includes rowbody
) with this line:
this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
因此不包含rowbody
功能;因此,不会注入.x-grid-rowbody-tr
类;因此rowexpander
找不到nextBd
的此类,并返回null.
Thus the rowbody
feature is not included; thus the .x-grid-rowbody-tr
class is not injected; thus rowexpander
can't find such class for nextBd
and returns null.
您应该尝试:
var iNewFeatures = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
this.features = iNewFeatures.concat( this.features );
最后,不能在InitComponent()
中启动插件,您可以将它们声明为config,也可以在构造函数中声明.参见
Lastly, plugins cannot be initiated in InitComponent()
, you can either declare them as configs, or within the constructor. See this thread for more info.
这篇关于ExtJS RowExpander-nextBd为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!