extjs 6 Nested grids with widgetcolumn

I'm trying to implement nestend grid in Extjs 6 with widgetcolumn (Using RowExpander is not good solution for my task).

Each record in the parent grid store has many subrecords with "hasMany association" store, which has to be editable with remote combobox.

But nested grids has conflicts in extjs.

How does it looks now: http://joxi.ru/52aQMXdCZjZP20

Source code:

{
        xtype: 'widgetcolumn',
        text: 'my-russian-header-text :)',
        tdCls: 'cell-no-padding',
        onWidgetAttach: function(column,widget,record) {
            // record.projections() returns hasMany store
            widget.bindStore(record.projections());
        },
        widget: {
            xtype: 'grid',
            viewType: 'tableview',
            border: 0,
            plugins: [{ ptype: 'cellediting', clicksToEdit: 1}],
            hideHeaders: true,
            scrollable: false,
            columns: [
                {
                    dataIndex: 'user_id',
                    editor:{},
                }
            ],
            listeners: {
                afterrender: function() {
                    this.getEl().swallowEvent([
                        'mousedown', 'mouseup', 'click',
                        'contextmenu', 'mouseover', 'mouseout',
                        'dblclick', 'mousemove', 'focus'
                    ]); // advice from here: http://hmxamughal.blog.com/2012/10/23/grid-in-grid/
                }
            }
        }
    },

I have such errors:

  1. Uncaught TypeError: Cannot read property 'isHeader' of null
  2. Uncaught TypeError: Cannot read property 'isGroupHeader' of null
  3. maximum call stack size exceeded

Can somebody help to find nice implementation of nested grid? or any different solution for my needs?

share improve this question
 
 
It's not going to work, I suggest you look for an alternate solution to nesting grids inside grids. –  Evan Trimboli  Dec 10 '15 at 20:20

1 Answer

I had your issue (using rowexpander actually), and i solved it with

Ext.create('Ext.grid.Panel', {
    plugins  : [{
        ptype      : 'rowexpander',
        rowBodyTpl : ['<div id="expander-inner-{id}"></div>'],
        pluginId: 'rowexpander'
    }],
    data: [{
        id: 1,
        val: "foo"
    }],
    ... //other options
});
var subgrid = Ext.create('Ext.grid.Panel', {
    renderTo: 'expander-inner-1',
    .... //other options
});
subgrid.getEl().swallowEvent([
      'mousedown', 'mouseup', 'click',
      'contextmenu', 'mouseover', 'mouseout',
      'dblclick', 'mousemove', 'focusmove',
      'focuschange', 'focusin', 'focusenter'
]);

Notice how the swallowEvent is called on the inner grid el, and the number of 'focus*' events swallowed. For me, focusenter did the trick to solve the nastier bug, maximum call stack size exceeded. I post this answer also if it is slightly unrelated (you don't want to use rowexpander) because I got the very same js exceptions, so I hope it'll be useful.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值