0

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
}
);

1 Answer 1

-1

you can use :

$scope.tableparams.page(1)
1
  • People who voted negatively for this, can you please provide a better solution ? Commented May 19, 2016 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .