I found a way to fix this problem by doing a simple hack.
The sorting is happening because of a call back function (registerDataChangeCallback) when there is notifyDataChange event gets fired and the processRowsCallback function is getting called and the processRowsCallback definition is as follows.
Grid.prototype.processRowsCallback = function processRowsCallback( grid ){
grid.queueGridRefresh();
};
Here Grid is a factory and the processRowsCallback functions is defined under the factory and its calling the grid.queueGridRefresh() and the sort is getting called and the sort happening just after the data changes in the grid.
So, I thought of overriding the prototype function processRowsCallBack by injecting the Grid factory to the factory which I have created (extendedGridFactory) and replicated the same function but having a condition checked, if the grid is not in editmode and calling grid.queueGridRefresh(); like the following.
app.factory('extendedGridFactory', ['Grid', '$rootScope', function (Grid, rootScope) {
var extendedGrid = Object.create(Grid);
extendedGrid.prototype.processRowsCallback = function processRowsCallback(grid) {
if (!rootScope.isInEditMode) {
grid.queueGridRefresh();
}
};
return extendedGrid;
}]);
Great, so far its works fine.
Let me know if you people finding any problem with this code. :)