Problem with update after sort
Problem with update after sort

Hello Team,
I am trying to update DataTables row data, there is a button on the row, when I click on it, it opens a pop up and I update the row with the updated data.
The row updates correctly, but when I SORT and then try to edit the row, it updates some different row in the table.
I am using the below code to update the data:
var table = $("#customerTable").DataTable();
var tableData = table.data();
tableData[$scope.SelectedRowIndex].CustomerId = selectedCustomerId;
tableData[$scope.SelectedRowIndex].CustomerName = selectedCustomerName;
table.row($scope.SelectedRowIndex).invalidate().draw();
I am using scroller with client side processing.
Any pointers would be helpful.
Regards,
Agraj