【问题标题】:ExtJS 4.2.0 RowExpander with load data dynamicExtJS 4.2.0 RowExpander 动态加载数据
【发布时间】:2013-03-26 11:08:40
【问题描述】:

我想使用 ExtJs 插件“RowExpander”,但是,我会在事件 expandbody 被触发时加载数据。 我试过这段代码,但我不知道如何设置 rwoBody Expanded 的内容:

this.GridPrincipal.getView().addListener('expandbody', function (rowNode, record, expandRow, eOpts) {


        Ext.Ajax.request({
            url: 'getData/' + record.get('id'),
            method: 'POST',
            success: function (result, request) {
            // retrive the data
            var jsonData = Ext.util.JSON.decode(result.responseText);
            //code to change the text of the RowBody
                            //....
            },
            failure: function (result, request) {
            Ext.MessageBox.alert('Failed', result.responseText);
            return false;
            }
            });



    });

非常感谢。

【问题讨论】:

    标签: javascript plugins extjs


    【解决方案1】:

    您可以将任何数据甚至其他组件呈现到扩展器中的一种解决方案是为其分配一个 div。

    plugins: [{
            ptype: 'rowexpander',
            rowBodyTpl: ['<div id="ux-row-expander-box-{id}"></div>'],
            expandOnRender: true,
            expandOnDblClick: true
        }]
    

    其中“id”是您商店的 id 字段。

    在 expandbody 事件下,您可以使用例如获取数据Ajax 请求,然后使用 renderTo 配置将包含数据的面板或网格等渲染到此 div 中。

    【讨论】:

      【解决方案2】:

      我也有同样的问题。我的解决方案是:

      Ext.get(expandRow).setHTML('New Text');
      

      我很想知道是否有更好的方法。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-22
        相关资源
        最近更新 更多