ngx-datatable icon indicating copy to clipboard operation
ngx-datatable copied to clipboard

'activate' event reports incorrect row/value

Open mikekov opened this issue 7 years ago • 5 comments

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior Take a look at http://swimlane.github.io/ngx-datatable/#cell-selection. Open dev tools and move selection around with arrow keys. You'll see that 'value' field lags behind what's selected.

The bug is here:

  onActivate(model: Model, index: number): void {
    const { type, event, row } = model;
    const chkbox = this.selectionType === SelectionType.checkbox;
    const select = (!chkbox && (type === 'click' || type === 'dblclick')) || 
      (chkbox && type === 'checkbox');
    if(select) {
      this.selectRow(event, index, row);
    } else if(type === 'keydown') {
      if ((<KeyboardEvent>event).keyCode === Keys.return) {
        this.selectRow(event, index, row);
      } else {
        this.onKeyboardFocus(model);
      }
    }
    this.activate.emit(model);
  }

onKeyboardFocus will move current cell/row, and activate.emit(model) reports stale information.

Expected behavior 'activate' event should report active cell/row.

Reproduction of the problem It's here: http://swimlane.github.io/ngx-datatable/#cell-selection

  • Table version: 0.9.2

  • Angular version: 4.1.x

mikekov avatar Jun 15 '17 19:06 mikekov

Is there any workaround for this issue?

brunork26 avatar Jan 19 '18 17:01 brunork26

Need a fix for this issue

mkprajeen avatar Feb 07 '19 08:02 mkprajeen

This is a serious issue needed to be fixed on priority.

rupraj-mitel avatar Feb 11 '19 06:02 rupraj-mitel

If we have a fix for this issue, will helps a lot please consider as a priority issue.

khadervali avatar Feb 11 '19 10:02 khadervali

we need this issue to be fixed as its important for us. Please let us know anyone is working on this? @mikekov do you have any other solution to fix this issue?

richa0312 avatar Aug 31 '22 20:08 richa0312