extjs4 - 带有 extjs 4 的嵌套网格

标签 extjs4

我可以把网格放在另一个网格的插件中。

这是我的网格,我想放入配置 'plugins' ext 网格。

 var grid = new Ext.grid.GridPanel({
                    store: store,
                    columns: [
        { header: 'Customer Name', dataIndex: 'CustomerName', width: 212 },
        { header: 'Charge Date', dataIndex: 'ChargeDate', width: 212 },
        { header: 'Package Plan', dataIndex: 'PackagePlan', width: 212 },
        { header: 'Current Invoice Sum', dataIndex: 'CurrentInvoiceSum', width: 212 }
     ],
                    plugins: [{
                        ptype: 'rowexpander',
                        rowBodyTpl: ['<div style="background-color:#CBDDF3; width:643px;margin-left:147px;margin-bottom: 20px;border: 1px solid;">',
            '<p><b>Customer Details:</b><br/>{CustomerName}<br/> {CustomerAddress}, {CustomerPhone}, {CustomerEmail} </p>',
                                '<p><b>Package Type:</b> {PackagePlan}<br/>',
                                '<b>Invoice Details:</b></p>',
                   '<div class="nestedO" id="{InvoiceId}"></div> </div>',
        ]
                    }],
                    width: 900,
                    height: 450,
                    renderTo: Ext.get('Ongoing')
                });

有可能吗?

最佳答案

嵌套网格是可能的。这是 Sencha 论坛的解决方案:

http://www.sencha.com/forum/showthread.php?151442-Nested-EXTJS-4-Grids&p=668193&viewfull=1#post668193

你几乎明白了。在插件部分,我们将创建一个空的 div,我们将在其中渲染我们的嵌套网格:

plugins: [{
        ptype: "rowexpander",
        rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']    
}],

当用户展开网格行时,我们会将嵌套网格渲染到其中。

expandbody : function(rowNode,record, expandbody) {
    var targetId = 'SessionInstructionGridRow-' + record.get('ClientSessionId');
    if (Ext.getCmp(targetId + "_grid") == null) {
        var sessionInstructionGrid = Ext.create('TS.view.client.SessionInstruction', {
            renderTo: targetId,
            id: targetId + "_grid"
        });
        rowNode.grid = sessionInstructionGrid;
        sessionInstructionGrid.getEl().swallowEvent(['mouseover', 'mousedown', 'click', 'dblclick', 'onRowFocus']);
        sessionInstructionGrid.fireEvent("bind", sessionInstructionGrid, { ClientSessionId: record.get('ClientSessionId') });
    }
}

关于extjs4 - 带有 extjs 4 的嵌套网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8254113/

相关文章:

javascript - 为什么当我渲染元素时 extjs 会调用刷新 URL?

javascript - ExtJS4:为什么当我在我的商店中使用 directFn 配置时,我需要将 directCfg.method 指定为 directFn 的属性

javascript - 强制布局字段集 ExtJs4?

ExtJS 4 - 组合框问题

javascript - 如何使用pressedcls改变extjs4中按钮的背景图片?

javascript - EXTJS Ext.util.Format.date 自动日期转换

javascript - 如何在 ExtJS 4 中获取子元素

javascript - 扩展JS 4.1 : renderer parameter in grid's columns doesn't work

php - TreeStore 传递参数 - EXTJS 4

javascript - Ext JS数据转换