Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
getCellByColumnVisibleIndex may return undefined
posted

I need to prevent moving to the next or previous row in igx-grid which happens during editing when Tab or Shift+Tab are hit.

(And to prevent editing of certain cells based on data)

In my sandbox solution (stackblitz) everything works fine up to the point when a width of the grid triggers scrolling(can be emulated with F12 and DevTools to the right occupying a half of the screen).

In such case grid.getCellByColumnVisibleIndex might return undefined.

Is there a safe analog?

Parents
  • 1080
    Offline posted

    Hi,

    After further investigation, my suggestion is to use a different approach by passing a callback function as a third parameter of the getNextCell and getPreviousCell methods in order to validate a given cell:

    const followingPosition = shift
          ? this.grid.getPreviousCell(
            activeCell.row,
            activeCell.column,
            (column: IgxColumnComponent) => this.isEditable(column, evt.target.row.rowData)
          )
          : this.grid.getNextCell(
            activeCell.row,
            activeCell.column,
            (column: IgxColumnComponent) => this.isEditable(column, evt.target.row.rowData)
          );


    I have forked and modified the provided sample for your reference. Please test it on your side and let me know how it behaves and does it meet your requirement.

Reply Children