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

[0.28.1+] When we use RMB on a column header to open context menu column gets sorted #4676

Closed
AMBudnik opened this Issue Dec 13, 2017 · 4 comments

Comments

@AMBudnik
Contributor

AMBudnik commented Dec 13, 2017

Description

When we use RMB on a column header to open context menu column gets sorted
Additionally, the beforeColumnSort hook does not fire for this action.

Steps to reproduce

  1. Use RMB to open a context menu on the header title

gif

Demo

http://jsfiddle.net/nmxndjfj/

Your environment

  • Handsontable version: 0.35.0
  • Browser Name and version: Chrome 63
  • Operating System: Windows 10
@JSalter02

This comment has been minimized.

JSalter02 commented Dec 14, 2017

Here’s how you might fix it:

  1. add event to the sorting plugin:

var _event = __webpack_require__(10);

  1. In the onAfterOnCellMouseDown event for column sorting, add a check for the left click like this:
if((0, _event.isLeftClick)(event)) {
  if ((0, _element.hasClass)(event.realTarget, 'columnSorting')) {
    // reset order state on every new column header click
    if (coords.col !== this.lastSortedColumn) {
      this.hot.sortOrder = true;
    }

    this.lastSortedColumn = coords.col;

    this.sortByColumn(coords.col);
  }
}

Shouldn’t be that hard.

Jonathan

@AMBudnik

This comment has been minimized.

Contributor

AMBudnik commented Feb 1, 2018

It still happens but only when we click directly on the header's title (text), not the whole header area.

@wojciechczerniak wojciechczerniak referenced this issue Mar 26, 2018

Closed

ColumnSorting plugin review #4966

13 of 18 tasks complete
@AMBudnik

This comment has been minimized.

Contributor

AMBudnik commented Apr 18, 2018

It's still replicable for the header names. It works the same in the latest version but it firstly has been made in v 0.28.1 as in v 0.28.0 that worked fine http://jsfiddle.net/evm27b7b/

@AMBudnik AMBudnik added the Regression label Apr 18, 2018

@AMBudnik AMBudnik changed the title from When we use RMB on a column header to open context menu column gets sorted to [0.28.1+] When we use RMB on a column header to open context menu column gets sorted Apr 18, 2018

@wszymanski wszymanski referenced this issue Oct 3, 2018

Open

Refactored columnSorting plugin - stage 3 #5442

4 of 10 tasks complete
@AMBudnik

This comment has been minimized.

Contributor

AMBudnik commented Oct 4, 2018

Still replicable in v 6.0.1.

@AMBudnik AMBudnik closed this Nov 14, 2018

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