EXTJS 中的嵌套网格 [英] Nested Grid IN EXTJS

查看:25
本文介绍了EXTJS 中的嵌套网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 ExtJS 中设计嵌套网格请提供一些示例(如何在 ExtJS GridPanel 中使用 RowExpander)

How to design Nested grids in ExtJS Please provide some samples(How to use RowExpander in ExtJS GridPanel)

推荐答案

试试这个:

 //Create the Row Expander.
var expander = new Ext.ux.grid.RowExpander({
     tpl : new Ext.Template('<div id="myrow-{Id}" ></div>')
});

//Define the function to be called when the row is expanded.
function expandedRow(obj, record, body, rowIndex){
    //absId parameter for the http request to get the absence details.
    var absId = record.get('Id');

    var dynamicStore = //the new store for the nested grid.

    //Use Id to give each grid a unique identifier. The Id is used in the row expander tpl.
    //and in the grid.render("ID") method.
    var row = "myrow-" + record.get("Id");
    var id2 = "mygrid-" + record.get("Id");  

   //Create the nested grid.         
   var gridX = new Ext.grid.GridPanel({
        store: dynamicStore,
        stripeRows: true,
        columns: [
            //columns
        ],
        height: 120,
        id: id2                  
    });        

    //Render the grid to the row expander template(tpl).
    gridX.render(row);
    gridX.getEl().swallowEvent([ 'mouseover', 'mousedown', 'click', 'dblclick' ]);
}

//Add an expand listener to the Row Expander.
expander.on('expand', expandedRow);

您可以在此处找到更多信息

这篇关于EXTJS 中的嵌套网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆