Reputation: 19569
I'm using ag-grid with angular and I have to support row edit mode. I've already prevented unwanted autosaving when you click elsewhere with supressClickEdit
, but if I'm in edit mode, and the user accidentally clicks "sort" on a column header, it saves their changes - which is what I want to avoid.
There is a sortChanged event which I can hook into to prevent saving, but the docs say that "grid also listens for this and updates the model".
Is there a way to plug into this sort event pipeline to prevent it?
Upvotes: 1
Views: 1743
Reputation: 7614
Once you are in edit mode, you can temporarily disable sort and re enable it after saving using a function like this -
Add [enableSorting]="enableSorting"
to your ag-grid div.
private enableSorting:boolean = true;
toggleSort() {
this.enableSorting = !this.enableSorting;
this.gridApi.refreshHeader();
}
Calling toggleSort will disable/enable sort accordingly.
Hope this helps!
Upvotes: 2