Opened 8 years ago

Closed 7 years ago

#13981 closed defect (patchwelcome)

dojox.grid._View._cleanupRowWidgets damages nested widgets

Reported by: Yasir Assam Owned by: Evan
Priority: high Milestone: tbd
Component: DojoX Grid Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

If you use a widget with nested widgets (composite widget?) in a TreeGrid (and possibly other grid types), function dojox.grid._View._cleanupRowWidgets will remove the nested widget DOM nodes from the widgets.

I spotted this bug when expanding a TreeGrid cell being edited (the widget was active).

Perhaps this is related to #13908?

In any case, here's what I've written to fix the bug:

dojo.extend(dojox.grid._View, {
    _cleanupRowWidgets: function(inRowNode) {
        // Summary:
        //     This overrides dojox.grid._View._cleanupRowWidgets
        //     which can't handle widgets with nested widgets
        if(inRowNode){
            var nestedWidgets = dojo.query("[widgetId] [widgetId]", inRowNode).map(dijit.byNode);
            dojo.forEach(dojo.query("[widgetId]", inRowNode).map(dijit.byNode), function(w){
                if (dojo.indexOf(nestedWidgets, w) == -1) {
                    if(w._destroyOnRemove){
                        w.destroy();
                        delete w;
                    }else if(w.domNode && w.domNode.parentNode){
                        w.domNode.parentNode.removeChild(w.domNode);
                    }
                }
            });
        }
    }
});

Change History (2)

comment:1 Changed 7 years ago by bill

DojoX Grid and EnhancedGrid are deprecated in favor of dgrid and gridx.

You should upgrade your code to use one of those two grids.

We will consider patches to the old DojoX Grid code though.

comment:2 Changed 7 years ago by bill

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.