Posted 10 January 2021, 5:04 pm EST
Hi Petr,
You can use the beginUpdate and endUpdate method to not display the changes in the grid. The updates performed after the beginUpdate call will only be reflected once the endUpdate method is called. You can call the beginUpdate method before updating the items using editItem and set the currentItem again before calling the endUpdate method. The multiple changes done between these 2 methods will not be reflected on the screen.
theGrid.cellEditEnded.addHandler((s, e) => {
s.beginUpdate();
var currentItem = s.collectionView.currentItem;
// call commitEdit to edit some other item
s.collectionView.currentItem = currentItem;
s.endUpdate();
});
beginUpdate: https://www.grapecity.com/wijmo/api/classes/wijmo_grid.flexgrid.html#beginupdate
endUpdate: https://www.grapecity.com/wijmo/api/classes/wijmo_grid.flexgrid.html#endupdate
If this does not work for you, there is also a different way to edit the items but it only works when deferCommits is set to true (as in your scenario). While this property is set to true, the ODataCollectionView saves all the updates in the itemsEdited, itemsAdded, etc arrays and uses them to update the data on the server.
So, you can update the item directly without using the editItem and commitEdit methods.
Instead of calling these methods, you will need to raise the collectionChanged event so that the collection view will add the edited item to the itemsEdited array. The sample link below demonstrates this behavior. In this sample, if you will edit any cell, the company name of the 4th row will be updated. Now if you will click on the commit button, both of these changes will be sent to the server.
https://stackblitz.com/edit/js-1zkcge
Note that the OData server used in this sample does not have the edit functionality implemented. So committing the edit will not actually update the data but you can observe the network tab of the browser’s console to check whether the correct data is sent to the server or not.
I hope this helps.
~regards