I am using ng-Table of angularjs for searching, sorting and pagination in my application. After searching i want to reset the value of page parameter of tableParams to 1. How can i achieve the same?
$scope.$watch("filter.$", function()
{
$scope.tableParams.reload();
$scope.caseWOTableParams.reload();
});
$scope.tableParams = new ngTableParams(
{ ** page: 1,
** // show first page
count: 10, // count per page
sorting:
{
name: "desc"
} //Initial sorting.
//filter: $scope.filter //filter
},
{
total: $scope.completedQueries.length, // length of data
getData: function($defer, params)
{
var filteredData = $filter('filter')(newWorkOrder, $scope.filter);
}
var orderedData = params.sorting() ?
$filter('orderBy')(filteredData, params.orderBy()) : filteredData;
//orderedData = $filter('filter')(orderedData, params.filter());
params.total(orderedData.length);
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
//filterOptions: $scope.filterOptions;
},
$scope: $scope
}
);