JS:
$scope.viewAccount = function(){
debugger;
$scope.displayAccount=true;
$scope.showviewAccount = true;
$scope.showListAccount = true;
$scope.showAddAccount = false;
var json = {
"json": {
"request": {
"servicetype": "6",
"functiontype": "6014",
"data": {
"shortname": $scope.model.selectShortName,
"groupzname": $scope.model.selectGname,
"city": $scope.model.selectCity,
"activationstatus": true,
"details": false,
"sortbasedon": $scope.groupzname,
"orderby": "desc",
"limit":10,
"offset":$scope.pagination
}
}
}
};
UserService.viewListAccount(json).then(function(response) {
if (response.json.response.statuscode == 0 && response.json.response.statusmessage == 'Success')
{
$scope.tableData = response.json.response.data;
}
});
};
HTML:
<tr data-ng-repeat="data in tableData" dir-paginate="data in tableData |orderBy:sortkey:reverse|filter:search|itemsPerPage:10" pagination-id="pagination1">
<td class ="stylethecontent" >{{ data.groupzcode}}</td>
<td class ="stylethecontent" >{{data.groupzname}}</td>
<td class ="stylethecontent" >{{data.shortname}}</td>
<td class ="stylethecontent" >{{data.city}}</td>
<td class ="stylethecontent" >{{data.state}}</td>
</tr>
我需要对上面给出的表格数据进行排序和分页。我有近150条记录。 json请求中的偏移量用于分页,记录需要显示数据,限制是需要在表中显示的记录数,我将其硬编码为10. sortby用于排序。我不知道在html页面中处理它们,因为我不熟悉angularjs以及我的JS中的Var JSON,你可以找到偏移和限制。