menu

Questions & Answers

Conditional rowClassRules on ag-grid only works from 2º emision on

I´m implementing Full Row Edition functionality within a ag-grid table. I´m trying to avoid lossing the focus on the new row edition if user click outside the row edition.

[screeshot]1

I´m using rowClassRules in a conditional way:

  rowClassRules = {
   'custom-pointer-event': (data: any) => {
    if (this.pointerEventAllow === false) {
      return data.rowIndex > 0;
      } else {
      return false;
  }
},

};

My intention is apply custom-pointer-event when the pointerEventAllow input is false

.custom-pointer-event {
  pointer-events: none !important;
}

The button Add row set the variable pointerEventAllow to true in order to remove the custo-pointer-event class and another button Cancel Edition set the pointerEventAllow variable to false in order to add the class to all rows with index bigger than 0.

I dont´t know why but only works after 2º click on Add row button. Maybe it has something to do with this info from Ag-grid documentation:

rowClassRules: Rules that return true will have the class applied the second time. Rules tha return false will have the class removed second time.

Comments:
2023-01-19 15:42:04
Can you please edit your question, it's really hard to understand, what is edition, do you mean adding, or editing? And what is , and emision?
Answers(0) :