Hi,
Seeing this error on the row.delete() method:
" Cannot invoke an object which is possibly 'undefined' "
The method is the following:
Hello Jose,
Thank you for posting to Infragistics Community!
I have been looking into your question and I assume that the “strictNullChecks” of the TSConfig compiler options is set to true. To explain the error origin, the object returned by the grid’s getRowByIndex method is of the RowType interface. As this interface is implemented by different objects representing rows, such as the IgxSummaryRow, which do not have a delete method, it is marked as optional.
So, what I can suggest is leveraging optional chaining with the function call to the row’s delete method:
row.delete?.();
Here is also a small sample having the “strictNullChecks” enabled and demonstrating this suggestion. Please, test it on your side and let me know how it behaves.
Best regards, Bozhidara Pachilova Associate Software Developer
Hi Bozhidara,
Yes, strict is set to true.
The proposed solution works, thank you very much.
Regards,
Jose
Hi Jose,
Thank you for confirming that the suggestion works for you!
Best regards,
Bozhidara Pachilova