I have an Angular UI grid
in my page. When the user double clicks one row, it shows a modal with the row data which the user can update.
Post successful update, i need to show the latest data in UI grid. To accomplish this, i have two options. They are,
Post successful bankend call, i need to reload my current state using $state.go($state.current, {} ,{reload: true}). Which will fetch the grid data to load the page.
Get the full list of updated data as the return of successful updation AJAX and , feed the data to the grid, ie $scope.gridOptions.data = latestData;
Please suggest the best approach.
Option #1 is definitely not an acceptable solution.
Option #2 is acceptable, you can refresh the gridOptions.data if necessary.
If you want a better performance, you do not need to get the full list, you can directly update the record once your post API is done. The pre-condition is you do not depend on any back-end data.