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
50
onRowEdit default behaviour when choosing another row from complete to cancel
posted

How can i change the default behaviour to cancel the edit event if a user clicks on another row after initiating a change to some cells on a row?

Parents
No Data
Reply
  • 1560
    Verified Answer
    Offline posted

    Hello,

    My suggestion is to handle the igxGrid's onCellEditEnter event and check whether the selected cell's row is currently in edit mode and if it is not to call the grid's endEdit method. This method finishes the row transactions on the current row and if we pass false as argument, the new value would not be committed.

    cellEditEnter(event:any){
    const row = this.grid1.getRowByIndex(event.cellID.rowIndex);
          if (!row.inEditMode) {
              this.grid1.endEdit(false);
          }
    }

    Here could be found a simple sample that demonstrates this approach.

    Please test it on your side and let me know if I may be of any further assistance.

    Sincerely,

    Teodosia Hristodorova

    Associate Software Developer

Children