New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid Grouping + CellEditing + CellSelection error if group is collapsed #1585

Closed
fabriciomurta opened this Issue May 18, 2018 · 3 comments

Comments

Projects
None yet
1 participant
@fabriciomurta
Contributor

fabriciomurta commented May 18, 2018

Found: 4.5.1
Ext.NET forum thread: Error Locking, Cell Editing Summary Grid
Related github issue (which fixes scenario using Row Selection model): #331.

In a grid where these conditions are met:

  • has grouping feature enabled
  • has cellEditing plugin
  • has cell selection model
  • one or more groups collapsed, leaving at least one group expanded, exposing editable cells

Upon editing one cell's value, an error will be thrown as CellModel's selectionChange event is triggered. At that point, current selection will be null and isSelected as false. This will lead to an unforeseen situation in the event handler that will cause a null reference to selection.view.

This issue is reproducible in this example: Grid Panel > Locking Grid > Grouping Summary

A very similar example, which just differs by using the default, Row Selection Model, works just fine: Grid Panel > Plugins > GroupingSummary

So, a way to avoid this issue is just not using Cell Selection Model in a grid with such a set up.

@fabriciomurta

This comment has been minimized.

Contributor

fabriciomurta commented May 18, 2018

This override can be used to address the issue with Cell selection model:

Ext.define('gh1585', {
    override: 'Ext.selection.CellModel',
    onSelectChange: function (record, isSelected, suppressEvent, commitFn) {
        var me = this,
            pos, eventName, view;
        if (isSelected) {
            pos = me.nextSelection;
            eventName = 'select';
        } else {
            pos = me.selection;
            eventName = 'deselect';
        }

        if (pos == null) return;

        view = pos.view || me.primaryView;
        if ((suppressEvent || me.fireEvent('before' + eventName, me, record, pos.rowIdx, pos.colIdx)) !== false && commitFn() !== false) {
            if (isSelected) {
                view.onCellSelect(pos);
            } else {
                view.onCellDeselect(pos);
                delete me.selection;
            }
            if (!suppressEvent) {
                me.fireEvent(eventName, me, record, pos.rowIdx, pos.colIdx);
            }
        }
    }
});
@fabriciomurta

This comment has been minimized.

Contributor

fabriciomurta commented May 18, 2018

This issue is most likely reproducible with pure ExtJS, so test and open an issue when we have an opportunity.

@fabriciomurta

This comment has been minimized.

Contributor

fabriciomurta commented Jun 14, 2018

Fixed! As the fix went to ExtJS code, this may be the case at some point we could remove this override. Preferably we should track/map this issue to another issue straight in Sencha -- if this is reproducible with pure ExtJS.

The fix will go public next Ext.NET release (see attached milestone).

@fabriciomurta fabriciomurta modified the milestones: 4.x, 4.6.0 Jun 14, 2018

@fabriciomurta fabriciomurta self-assigned this Jun 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment