Hello,I have a misunderstanding regarding the use of updateCell in my igx-grid.I have this error message:
However I have specified a primarykey. I don't understand why I have the error message in the cellEdit method.
Have you an idea ?
best regards,
Philippe DUFEIL
Hello Philippe,
Thank you for posting in our community!
I have been looking into your question and after reviewing the provided snippet from the console log, what I could say is that the most common reason for receiving such an error is if the selector provided in the ViewChild is not equal to the one assigned to the IgxGrid in the html file.
For example:
// component.html<igx-grid #grid [data]="data" [autoGenerate]="true"></igx-grid>
// component.ts@ViewChild('grid1', { read: IgxGridComponent, static: true }) public grid!: IgxGridComponent;
Additionally, regarding the updateCell method, I am under the impression that you require when a cell is edited in a specific column, this value should be applied to another cell in the respective row as well. If my impression is correct, I believe that you will find this small sample, which I have prepared for you quite helpful.
Please test this approach on your side and let me know if you need any further assistance regarding this matter.
Looking forward to your reply.
Sincerely,Riva IvanovaEntry Level Software Developer
Hello Riva,Thank you for the example that works well. Nevertheless, the problem persists.After a long search, I found the source of the problem.
Here is the context in which I was able to reproduce the error:My grid is in a <igx-tabs> that I condition by using in the html code *ngIf
I don't understand why using a *ngIf in a <igx-tab-item> generates an error with the <igx-grid> updateCell.Do you have an alternative to this problem?
Thanks for your help.
Best regards,
Thank you for following up!
After further investigating this matter, I was able to reproduce the described behavior and determined that the reason for receiving this error is due to the static property of the ViewChild property decorator in the attached sample is set to true.
As mentioned in Angular’s official documentation here, when the static property is set to true, the query results are resolved before change detection runs, meaning that it is expected that this component is always available on the page, no matter page bindings, API calls, *ngIf directives, etc.
However, in this specific scenario the component is dependent on the *ngIf structural directive and with this in mind, I suggest changing the static property to false (or omitting it as the default value is false). This will ensure query matches that are dependent on binding resolution (e.g., *ngIf structural directive) will be found.
Additionally, in order to demonstrate my suggestion, I have modified the previously attached sample and it could be found here.
Please test it on your side and let me know if I may be of any further assistance.
Looking forward to hearing from you.
I am glad I was able to assist you regarding this matter.
Thank you for using Infragistics components.
Regards,Riva IvanovaEntry Level Software Developer
Thank you Riva for your prompt reply. It is perfect.