cannot create a new row after calling editor preopen function
cannot create a new row after calling editor preopen function

I am calling an editor`` preOpen function
to disable the inline editing of row if value for column status= confirmed.
using :
editorMain.on( 'preOpen', function ( e, mode, action ) {
var getStatus = tablepromotions.row( editorMain.modifier().row).data();
console.log(getStatus.status)
if (getStatus.status == 'CONFIRMED') {
alert("You cannot Edit confirmed Agreements");
return false;
} else{
}
} );
It is working perfectly fine. However , when I want to create a new row it gives me error Cannot read property 'row' of null
for this line var getStatus = tablepromotions.row( editorMain.modifier().row).data();
I assume that when I am trying to create a new row, preOpen editor function
looks for the row id which is NULL when creating a new row and hence giving the error .
How can I overcome this?
Thank you
This question has an accepted answers - jump to answer
Answers
Just an update, I found away to do it by disabling each field separately by:
However, it will be better if I can disable full row once rather than doing it for each field separately
In addition to this , if I call the function when editor is open rather than preOpen does the trick
The best option would be to check the parameters to
preOpen
. You could either check the second one,mode
, to tell if you're in form (main
) orinline
. But you could always use the third,action
, and only do your check if it'sedit
,Colin
@colin Thank you very much. That helped