igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

IgxGrid does not reflect a value selected on IgxSelect used as the editor template when overlay animation is disabled

Open ymita opened this issue 5 years ago • 2 comments

Description

IgxGrid does not reflect a selected value from IgxSelect which is the editor template. This only happens when the open and close animation of IgxSelect are disabled. A similar issue was reported and it has already been fixed. https://github.com/IgniteUI/igniteui-angular/issues/9629

  • igniteui-angular version: 11.1.15
  • browser: n/a

Steps to reproduce

  1. Run the attached sample
  2. Start editing on column1 (=> It leads to open IgxSelect)
  3. Select an item from IgxSelect

Result

The selected item on step 3 is not reflected on IgxGrid cell.

Expected result

The selected item on step 3 is reflected on IgxGrid cell.

Attachments

igx-grid-select.zip

ymita avatar Jun 24 '21 01:06 ymita

In handleClosed you are calling this.grid1.endEdit(true). However at this point ngModel did not succeed to update the cell edit value. This is why you are actually updating the cell with its old value. One way to solve this is to call endEdit in setTimeout. This will allow ngModel to update the value and endEdit will use updated value. Note you should also call detectChanges as endEdit will not do this. Here is how event may look like:


  handleClosed(cell: IgxGridCellComponent) {
    setTimeout(() => {
      console.log('handleClosed');
      // End edit mode of IgxGrid once IgxSelect closes.
      this.grid1.endEdit(true);
      this.grid1.cdr.detectChanges();
    }, 0);
  }

wnvko avatar Jun 25 '21 13:06 wnvko

Hi @wnvko, Thank you for looking into this issue. I see your code works on my end as well.

ymita avatar Jul 02 '21 11:07 ymita