I need to be able to refresh the data in my ng-table. The following images contain the full use case scenario. When a user clicks the search for BrandID, a new modal window apears:
It contains an ng-table with some loaded data into it. After the modal is dismissed I click on the second search(GroupID), here the same modal window with an ng-table is opened but even if the request is ok and data is returned from the server, the loading fails:
I would like to be able to refresh the table in order to initialize it with the newly received data.
The script in the Plunker is called each time the modal toggles.
Try this to update table data:
$scope.tableParams.reload();
Edit: I found a possible bug in your code... I think you should change this:
var orderedData = params.sorting() ?
$filter('orderBy')(filteredData, params.orderBy()) :
$scope.datay;
to this:
var orderedData = params.sorting() ?
$filter('orderBy')(filteredData, params.orderBy()) :
filteredData;
Does that work better?