AngularJs智能表分页 - 始终重置为首页

时间:2015-10-13 23:40:29

标签: angularjs pagination smart-table

出于某种原因,我的分页总是重置为1作为所选页面,即使结果从服务器返回,结果EG记录31-45中的正确数据)并在智能表中正确填充。是什么原因导致它始终将分页视图中的选定页面重置为第1页?有没有办法说出所选页面是什么?

提前致谢

控制器方法

 $scope.getData = function (tableState) {
        var pagination = tableState.pagination;
        var start = pagination.start || 0;
        var number = pagination.number || 10;

        $scope.users = UserServicePaging.query({offset: start});
        $scope.users.$promise
            .then (function (result) { //success
                $scope.users = result[0].results;
                $scope.rowCollection = $scope.users;
                $scope.displayedCollection =  [].concat($scope.rowCollection);  
                tableState.pagination.numberOfPages = Math.ceil(parseInt(result[0].records.total)) / 15;
                tableState.pagination.totalItemCount = Math.ceil(parseInt(result[0].records.total));
            },
            function (error) {//fail

            })
            .finally(function() {

            });
    }

表标题:

 <table st-table="displayedCollection" st-safe-src="rowCollection" st-pipe="getData"  class="table table-striped">

表页脚

<td colspan="5" class="text-center">
     <div st-pagination="" st-items-by-page="itemsByPage" st-displayed-pages="10"></div>
</td>

0 个答案:

没有答案