尝试使用行扩展器制作网格并遇到奇怪的行为。
第一行展开的视图获得了3的colspan(表格中的列数), 第二个获得2的colspan,后面的任何行获得1的colspan。
有人可以解释为什么会这样,也可以指定扩展行的内容应该填充所有内容(colspan设置为表中的列数)。
的jsfiddle:
代码:
Ext.onReady(function(){
var store = Ext.create('Ext.data.Store',{
fields: ['id','name','ship'],
data: [{
id: 1,
name: 'Kirk',
ship: 'Enterprise'
},{
id: 2,
name: 'Picard',
ship: 'Enterprise'
},{
id: 3,
name: 'Janeway',
ship: 'Voyager'
},{
id: 4,
name: 'Khan',
ship: 'Reliant'
}]
});
Ext.create('Ext.grid.Panel',{
title: 'Test',
renderTo: Ext.getBody(),
store: store,
columns: [{
text: 'ID',
dataIndex: 'id'
},{
text: 'Name',
dataIndex: 'name'
},{
text: 'Ship',
dataIndex: 'ship'
}],
plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [
'<div class="row-details-panel" id="row-details-panel-{id}">{id} = {name}</div>'
]
}],
listeners: {
afterrender: function (grid) {
// hide the first row generated by rowExander plugin
grid.getView().getHeaderAtIndex(0).hide();
}
}
});
});
答案 0 :(得分:1)
很可能是Ext 4.2.0版本的错误。我已经在https://fiddle.sencha.com处针对Ext 4.2.1运行了代码,它的行为符合预期 - colspan始终为3。
升级到4.2.1,这不应该是一件大事。