Targetprocess Product Blog

Agile development on a real project (we do Kanban)

TargetProcess Development Tricks: Force ExtJS GridPanel skip events processing raised from nested grid panels

We got a problem with implementing inner grids based on ExtJS. ExtJS GridPanel reacts on every event from inner GridPanel by default. For example sorting in nested grid causes the sorting in parent. That is not good. Find below the code which will allow to deny the event processing in GridPanel if it is fired in its child grid panel:

Ext.override(Ext.grid.GridPanel, {
    processEvent: function(name, e) {
        var t = e.getTarget();

        if (!t) {
            return;
        }

        if (!this.el) {
            return;
        }

        if (jQuery('#' + this.el.id).find('.x-grid3').length > 1 && jQuery(t).parents('.x-grid3').length > 1) {
            return;
        }

        this.fireEvent(name, e);

        var v = this.view;
        var header = v.findHeaderIndex(t);

        if (header !== false) {
            this.fireEvent("header" + name, this, header, e);
        } else {
            var row = v.findRowIndex(t);
            var cell = v.findCellIndex(t);
            if (row !== false) {
                this.fireEvent("row" + name, this, row, e);
                if (cell !== false) {
                    this.fireEvent("cell" + name, this, row, cell, e);
                }
            }
        }
    }
});

Targetprocess Help

All you want to know about Targetprocess

Recent posts