AngularJS:UI网格自定义分页不起作用

时间:2019-02-21 13:06:48

标签: angularjs pagination angular-ui-grid

我试图在ui-grid中使用minRowToShow = 3的自定义分页,但是所有行都在同一页面上呈现而不是分页。

数据正在JSON数组中返回。 例如:

 [  {
                        "grievance_id":"1",
                        "Grievance_type":"1",
                        "assigned_committee":"1",
                        "doi":"1",
                        "employed":"1",
                        "eta":"1",
                        "status":"1",
                        "attachment":"1",
                        "action":"1"

                    },{.....},{.....}]

html代码:

<div class="row">
          <div class="col-lg-12 col-md-12 open-grievance ">
              <h5 class="grievance-heading">Open Grievance</h5>
                <div class="table grid">
                <div id="grid1" ui-grid="open_grievance"  ui-grid-cellNav ui-grid-auto-resize  class="sub-grid"></div>
                <div class="text-center page" ng-show="open_grievance.totalItems > numRows">
              <pagination class="pagination-sm" total-items="open_grievance.totalItems" items-per-page="open_grievance.paginationPageSize" ng-model="open_grievance.paginationCurrentPage"></pagination>
      </div>
                </div>
          </div>
      </div>

Angular Js:

    studentService.open_grievances().then(function(success)
                     {   

                            $scope.open_grievance_data = success.data.open;
                            $scope.open_grievance.data = $scope.open_grievance_data;

                             $scope.escalated_grievance_data = success.data.esclated;
                            $scope.escalated_grievance.data = $scope.escalated_grievance_data;

                            $scope.grievance_history_data = success.data.resolved;
                            $scope.grievance_history.data = $scope.grievance_history_data;



                    }, function(error)
                         {

                              });

$scope.numRows=3;
 $scope.open_grievance = {
        data:$scope.open_grievance_data,
            enableGridMenus:false,
            enableSorting: false,
            enableFiltering:false,
            enableCellEditing:false,
            enableColumnMenus: false,
            enableHorizontalScrollbar:0,
            enableVerticalScrollbar:0,
            totalItems: $scope.open_grievance_data.length,
        paginationPageSize: $scope.numRows,
        minRowsToShow: $scope.open_grievance_data.length < $scope.numRows ? $scope.open_grievance_data : $scope.numRows,
        enablePaginationControls: false,


        columnDefs: [
            { name : "grievance_id",display: 'Grievance ID', cellTemplate: '/views/cellTemplate/cell.html' },
            { name:"grievance_type" ,display: 'Grievance Type', cellTemplate: '/views/cellTemplate/cell.html'},
            { name:"assigned_committee" ,display: 'Assigned Committee',  cellTemplate: '/views/cellTemplate/cell.html'},
            {name :"data_of_issue" ,display: 'Date of Issue' ,cellTemplate: '/views/cellTemplate/cell.html' },
            {name:"eta", display: 'ETA' ,cellTemplate: '/views/cellTemplate/cell.html'},
            {name:"status" ,display: 'Status', cellTemplate: '/views/cellTemplate/cell.html '},
            {name:"attachment",display: 'Attachment',cellTemplate: "/views/cellTemplate/attachment.html"  },
            {name:"action",display: 'Action', cellTemplate: "/views/cellTemplate/student_action.html"},
                    ],


         };

控制台上没有显示错误。 页面选择器已呈现但不起作用。

谢谢

0 个答案:

没有答案