javascript - ExtJS RowExpander 插件奇怪的 colspan

标签 javascript extjs extjs4 extjs4.2

尝试使用行扩展器制作网格并遇到奇怪的行为。

第一行的展开 View 的 colspan 为 3(表中的列数), 第二行的 colspan 为 2,后续行的 colspan 为 1。

有人可以解释为什么会发生这种情况,以及指定扩展行的内容应填充所有内容的方法(colspan 设置为表中的列数)。

JSFiddle:

JSFiddle working example

代码:

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();
        }
    }
});

});

最佳答案

这很可能是Ext 4.2.0版本的错误。我已经在 https://fiddle.sencha.com 运行了你的代码与 Ext 4.2.1 相比,它的行为符合预期 - colspan 始终为 3。

升级到4.2.1,应该没什么大不了的。

关于javascript - ExtJS RowExpander 插件奇怪的 colspan,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24085515/

相关文章:

css - Sencha 触摸 2 : 3 containers: stick to the left (fixed width) + stick to the right (fixed width) +middle (the rest)

extjs - 如何将工具栏中的元素左、中、右对齐

extjs - 以编程方式选择网格行不会触发 ExtJS4 中的 itemclick 事件

javascript - ExtJS:容器默认样式从何而来?

javascript - React 类方法外的函数未定义

javascript - 如何在 Django 应用程序中通过 javascript 执行客户端软件?

jquery - 无法更新(PUT)和删除(删除)django-piston 中的数据

javascript - ExtJs4 - 存储 baseParams 配置属性?

javascript - 按下 Tab 键时出现焦点问题

javascript - 从单独的 gulp 文件导入/读取变量