I am using angular ui-grid to display tabular data.
The cell data can be edited. I noticed that if a column is sorted and then if we edit the cell, the sorting gets kicked in and moves the row. I would like to disable sorting on cell edit, is there any way to do this. I have provided plunker link below. In the plunk first sort the first column in ascending order then edit value of a2 to say x and click outside the cell, you will see that eidted row now moved to the last. I would like to prevent sorting on edit, basically its OK if we remove all the existing active column sorts on edit.
<div id="grid1" ui-grid="gridOptions" class="grid" ui-grid-edit > </div>
var app = angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid','ui.grid.edit',
'ui.grid.selection',
'ui.grid.rowEdit', 'ui.grid.cellNav']);
app.controller('MainCtrl', function($scope) {
$scope.gridOptions = {
enableSorting: true,
columnDefs: [
{ field: 'A' },
{ field: 'B' },
{ field: 'C', enableSorting: false }
],
onRegisterApi: function( gridApi ) {
$scope.gridApi = gridApi;
}
};
$scope.gridOptions.data = [{'A':'a1', 'B':'b1', 'C':'c1'}, {'A':'a3', 'B':'b3', 'C':'c3'}, {'A':'a2', 'B':'b2', 'C':'c2'}];
});
see Plunk for the behavior http://plnkr.co/edit/17H5K6nOEz9gf4Keeap9?p=preview