0
votes

I'm using ExtJS 6.7 Modern toolkit and Ext.grid.Tree.selectOnExpander = false does not work properly when data for expandable node is loading from a remote server, i.e. node is selected when I click on the expander.

I expect that in this case the node will NOT be selected as in the case when the data is already loaded.

Check this fiddle as an illustration - try to expand node when it is loaded and when it is not loaded yet using expander.


So far I've tried to check fired events with Ext.util.Observable.capture and it seems like extra childtap event is triggired. I don't yet understand why. Seems like a bug for me.

2

2 Answers

1
votes

Seems they forgot to implement the logic.

From the code I would sugget to use this snippet. It extens the logic from Ext.dataview.List using the same style.

Sencha Fiddle: Fiddle

Ext.define('Portal.grid.Tree', {
    override: 'Ext.grid.Tree',

    shouldSelectItem: function(e) {
        var me = this,
            no = !me.callParent([e]),
            cmp;

        if (!no && !me.selectOnExpander) {
            cmp = e.getTarget();
            no = cmp.classList.contains('x-expander-el');
        }

        return !no;
    }

});

0
votes

The best solution I have found so far is to override Ext.grid.Tree onChildTap method (inherited from Ext.dataview.Abstract) like this:

Ext.define('Portal.grid.Tree', {
    override: 'Ext.grid.Tree',

    /** Override Ext.dataview.Abstract onChildTap method for correct processing selectOnExpander property **/
    onChildTap: function(location) {
        if (this.getSelectOnExpander() || location.event.target !== location.cell.expanderElement.dom) {
            this.callParent(arguments);
        }
    },
});