【问题标题】:Ext JS components within an expanded row展开行中的 Ext JS 组件
【发布时间】:2013-10-01 04:59:12
【问题描述】:

这里有一个简单的问题:我有一个工作网格,在我的 Ext JS 应用程序中扩展行。 轰隆隆。

目前,我的展开行中有html 元素(它只是一个大的div),但这似乎是展开行能够显示的所有内容。

是否有在我展开的行的内部渲染 Ext 组件?

朋友们,加油!

【问题讨论】:

    标签: javascript extjs grid row


    【解决方案1】:

    您可以只将组件渲染到行扩展器元素中。

    var grid = Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        plugins: {
            ptype: 'rowexpander',
            rowBodyTpl : [
                '<div class="row-expander-ct"></div>'
            ]
        },
        store: {
            fields:['name', 'email', 'phone'],
            data: [
                { 'name': 'Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
                { 'name': 'Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
                { 'name': 'Homer', "email":"home@simpsons.com",  "phone":"555-222-1244"  },
                { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  }
            ]
        },
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 300,
        width: 400,
        renderTo: Ext.getBody()
    });
    
    grid.store.on({
        // Delay the execution of the listener because the grid view will also
        // react to this event, and we want the rows to be rendered before we
        // modify them...
        delay: 1,
        load: function() {
            Ext.each(grid.el.query('.row-expander-ct'), function(ct) {
                Ext.widget('textfield', {
                    renderTo: ct
                    ,fieldLabel: "Label"
                    ,width: '100%'
                });
            });
        }
    });
    
    grid.store.load();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      • 1970-01-01
      • 2015-11-13
      • 1970-01-01
      • 2013-09-21
      相关资源
      最近更新 更多