带有rowExpander的嵌套网格创建问题

时间:2014-04-03 15:51:20

标签: extjs

我正在使用带有rowExpander的Extjs3.2嵌套网格。

在我的情况下一切正常...... 但每当我点击子网格中的第n行时,父网格的第n行也会被选中。 如何阻止这个......请帮助??

我的代码

 var expander = new Ext.ux.grid.RowExpander({
                 expandOnDblClick : false,
                 tpl : new Ext.Template('<div id="NestedGridRow-{id}"></div>'),

                 renderer: function(v, p, record) {
                        if (record.get('cmaStatus') == 'G') {
                            p.cellAttr = 'rowspan="2"';
                            return '<div class="x-grid3-row-expander"></div>';
                        } 
            },


            });



            expander.on('expand', expandedRow);

            function expandedRow(obj, record, body, rowIndex){
                //absId parameter for the http request to get the absence details.


                //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 = "NestedGridRow-" + record.get("id");
                var id2 = "mygrid-" +record.get("id"); 

                sapid_para = record.get('sapid');
               //Create the nested grid.         
               var gridX = new Ext.grid.GridPanel({
                   id:'nestedGrid',
                    store: storenested,
                    //stripeRows: true,
                    columns: [


                        {
                            header : "CMA Date",
                            width : 120,
                            sortable : true,
                            dataIndex : 'cmaDate',

                        },
                        {
                            header : "Source Model",
                            width : 120,
                            sortable : true,
                            dataIndex : 'sourceModel',

                        },

                        {
                            header : "Remarks",
                            width : 390,
                            sortable : true,
                            dataIndex : 'remarks',

                        }],
                height: 120,
                id: id2,
                plugins : [editor],
                renderTo: row,
                stripeRows:true,
                listeners: {
                    render: function(gridX) {
                        gridX.getView().el.select('.x-grid3-header').setStyle('display', 'none');
                    },

                    rowclick : function(grid,rowIndex,e) {
                        alert(rowIndex);                                       
                        }


                    },

                                });  
                gridX.render(row);


                //Ext.getCmp('grid_lineage').getStore().load({params:{start:0, limit:10}});
                storenested.load({params:{start:0, limit:10}});

1 个答案:

答案 0 :(得分:0)

两个网格上是否有rowSelectionModel的相同实例?

编辑: 尝试添加两个网格定义:

selModel: new Ext.grid.RowSelectionModel({singeSelect:true}),