NgTableParams参数不起作用

时间:2016-06-19 11:09:20

标签: angularjs ngtable

我正在学习angularjs,我正在尝试实现ngTable。现在我的数据显示在表格中,但分页不起作用,我可以在底部看到页码,但所有结果都显示在一个页面中。

来自控制器的相关部分

angular.module('ui.bootstrap.demo').controller('documentNameTypeAheadController', function ($scope, $http, $filter,
                                                                                        NgTableParams,
                                                                                        $uibModal, $timeout, $log
                                                                                        )

$scope.submit = function () {
        var queryForm = {
            "gridName": gridName,
            "dataType": $scope.selectedDocumentTypeName,
            "criteria": $scope.queryCriteria,
            "spaceName" : spaceName
        };

        $http.post('http://localhost:8080/query/getDataFromSpaceForType.html', queryForm)
            .success(function (data) {
                var tabD = [{"id":1,"first_name":"Philip","last_name":"Kim","email":"pkim0@mediafire.com","country":"Indonesia","ip_address":"29.107.35.8"},
                    {"id":2,"first_name":"Judith","last_name":"Austin","email":"jaustin1@mapquest.com","country":"China","ip_address":"173.65.94.30"},
                    {"id":3,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":5,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":6,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":7,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":8,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":9,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":30,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":11,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":12,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":13,"first_name":"Julie","last_name":"Wells","email":"jwells2@illinois.edu","country":"Finland","ip_address":"9.100.80.145"},
                    {"id":4,"first_name":"Gloria","last_name":"Greene","email":"ggreene3@blogs.com","country":"Indonesia","ip_address":"69.115.85.157"}];
                $scope.headerNames = data.fieldNames;
                $scope.spaceIdFieldName = data.spaceIdFieldName
                $scope.detailedTypeData = tabD;

                $scope.tableParams =  new NgTableParams({},  {dataset: tabD});
            });
    };

我正在进行休息调用,但是对于调试我只是想在这里显示静态定义的数据

HTML:

<div>
 <table ng-table="tableParams" show-filter="true" class="table">
     <tr ng-repeat="user in detailedTypeData">
        <td data-title="'Id'" >
            {{user.id}}
         </td>
         <td data-title="'First Name'" >
          {{user.first_name}}
          </td>
       </tr>
  </table>

数据显示在单页中,这里有13个条目,我可以在底部看到2个页面,但都显示完整的13个条目

0 个答案:

没有答案