TargetProcess Development Tricks: Force ExtJS GridPanel skip events processing raised from nested grid panels | Targetprocess - Enterprise Agility Solution
16 years ago

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);
                }
            }
        }
    }
});
Capterra Top 20
Capterra Top 20
Project Portfolio Management
May-20
GetApp Category Leaders
GetApp Category Leaders
Project Portfolio Management
Jul-20
GetApp Category Leaders
GetApp Category Leaders
Roadmaps
Jul-20
Software Advice FrontRunners
Software Advice FrontRunners
Product Management
May-20
Software Advice Recommended
Software Advice Recommended
Product Roadmap
Mar-20
Software Advice Customer Support
Software Advice Customer Support
Project Portfolio Management Software
Jun-20

Subscribe to the latest updates

Thank you!

Сheck out latest blog posts: Show all