Hello,
I'm using "splice" syntax in order to delete and add record dynamically in igx-grid on item dropped. It works fine but when i add a summary (hassummary=true) in a footer column, row move doesn't work.
Have you some idea ?
Best regards.
Hello Philippe,This behavior is caused because the already bound data property of the grid is mutated. Since the grid is OnPush by default it does not do a deep check on it. When there are a lot of records this is an advantage because we do not have to check each of them on every detection cycle. What I can suggest is changing the reference of the input or to manually trigger the change detector of the grid:
public onDropAllowed(args) { ... this.data.splice(args.dragData.index, 1); this.data.splice(currRowIndex, 0, args.dragData.data); this.data = [...this.data]; }
public onDropAllowed(args) { ... this.data.splice(args.dragData.index, 1); this.data.splice(currRowIndex, 0, args.dragData.data); this.grid.markForCheck(); }
I have updated the previously provided sample to illustrate my suggestion. Please test it on your side and let me know whether you find it helpful.
Regards,Viktor KombovEntry Level Software DeveloperInfragistics, Inc.
Hello Victor,I looked at your example and it works well. But...you use the following syntax in "OnDropAllowed" method in your example : this.grid.deleteRow(args.dragData.key); this.data.splice(currRowIndex, 0, args.dragData.data);And this is problematic for me because the "deleteRow" calls my method (rowDeleted) that I have on my grid. And I don't want it to be called in this context.
I use : this.data.splice(args.dragData.index); this.data.splice(currRowIndex, 0, args.dragData.data);
And I don't understand why "this.data.splice(args.dragData.index);" is a problem when the "hassummary=true"
I hope my problem is clear to you.
Looking forward to hearing from you.
Philippe
Hello Philippe,
Thank you for posting in our community.
I have created a small sample trying to reproduce the described behavior. I am using the implementation of the Row Reordering Demo in our official documentation. On my side everything works as expected and when a column has summaries, the reordering feature is working as expected.
Please test the sample on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own isolated sample, where the issue is reproducible. Please keep in mind to remove any dependencies and code that is not directly related to the issue.
Having a sample, which I can debug on my side, will be highly appreciated and extremely helpful for providing you with solution as soon as possible.
Thank you for your cooperation.