angularjs中使用的数据表无法正常工作。 You can see in the image there are 38 records When I click on Number 2 in data table pagination, it shows as Showing 11 to 20 of 38 items, but the records in the table are still 1 to 10, you can see in the image 这是我的代码:
<tbody data-ng-if="reviewers.length">
<tr data-ng-repeat="reviewer in reviewers">
<td align="center"><a href="javascript:void(0)" data-ng-click="getTaskInfo(reviewer.taskId)">{{reviewer.gtaskId}}</a></td>
<td align="center">{{reviewer.serviceName}}</td>
<td align="center">{{reviewer.projectSubject}}</td>
<td align="center">{{reviewer.taskCreatedDate | date : 'dd MMM yyyy'}}</td>
<td align="center">{{reviewer.taskEndDate | date : 'dd MMM yyyy'}}</td>
</tr>
</tbody>
controller.js中的代码是
$scope.searchkey='';
$scope.getReviewerTaskDetails = function(currentPageIndex){
ReviewerService.getAllReviewerTaskCount().then(function(response){
$scope.taskscount = response.data;
});
ReviewerService.getPendingTaskCount().then(function(response){
$scope.pendingcount = response.data;
});
ReviewerService.getCompletedTaskCount().then(function(response){
$scope.completedcount = response.data;
});
ReviewerService.getDeletedTaskCount().then(function(response){
$scope.deletedCount = response.data;
});
ReviewerService.getReviewerTaskCount($scope.searchkey).then(function(response){
$scope.paginationIndex = [];
$scope.pageFullIndex = response.data;
console.log($scope.pageFullIndex);
var pagesize = Math.ceil(($scope.pageFullIndex)/($scope.recordsPerPage));
for(var i=1;i<=pagesize;i++){
$scope.paginationIndex.push(i);
}
});
ReviewerService.getReviewersTaskByIndex(currentPageIndex,$scope.recordsPerPage,$scope.searchkey).then(function(response){
$scope.reviewers= response.data;
$scope.pageStartIndex = ((currentPageIndex-1)*($scope.recordsPerPage))+1;
$scope.pageEndIndex = (($scope.pageStartIndex)+response.data.length)-1;
$scope.currentPageIndex = currentPageIndex;
$scope.selected = currentPageIndex;
});
};
即使有时候数据表没有正确加载而且没有显示总显示为0到0为0的记录,也没有分页编号,也没有搜索工作。
如果我选择100作为每页记录,那么所有记录都会显示在页面上。有些人可以帮我解决这个问题。