我有一个非常简单的网格,我正在尝试启用分页,但分页控件不会出现。这就是我所拥有的:
我添加了“ui.grid.pagination'作为我的app模块的依赖。
HTML:
<div ui-grid="gridOptions" ui-grid-selection ui-grid-pagination external-scopes="$scope" class="campaigns-grid"></div>
JS:
$scope.gridOptions = {
data: 'campaigns',
enableRowSelection: true,
noUnselect: true,
enableRowHeaderSelection: false,
multiSelect: false,
enablePaginationControls: true,
paginationPageSize: 5,
paginationPageSizes: [5, 10, 15],
rowTemplate: '<div ng-dblclick="getExternalScopes().onDblClickRow(row)" ng-click="grid.appScope.fnOne(row)" ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ui-grid-cell></div>',
columnDefs: [
{ field: 'name', displayName: 'Name' },
{
name: 'delete',
displayName: 'Delete',
enableCellEdit: false,
width: 200,
cellTemplate: '<a href ng-click="getExternalScopes().deleteCampaign(row.entity)"><i class="fa fa-trash deleteButton"></i></a>'
}
]
};
答案 0 :(得分:0)
RC 16中没有分页,您应该使用最新的不稳定版本。
https://github.com/angular-ui/ng-grid/issues/2479
编辑:
作为一个不稳定的我认为不包含在可用版本中,事实上在运行bower info angular-ui-grid
时,我看到了:
可用版本:
- 3.0.0-rc.16
- 3.0.0-rc.15
- 3.0.0-rc.14
- 3.0.0-rc.13
- 3.0.0-rc.12
- 3.0.0-rc.11
- 3.0.0-rc.10
- 3.0.0-rc.8
- 3.0.0-rc.7
- 3.0.0-RC.18
因此无法通过bower安装不稳定版本,无论是下载文件还是将其包含在主机中:https://github.com/angular-ui/ng-grid#how-can-i-test-30
答案 1 :(得分:0)
module = angular.module(&#39; app&#39;, [&#39; ngTouch&#39;,&#39; ui.grid&#39;,&#39; ui.grid.edit&#39;,&#39; ui.grid.autoResize&#39;,&#39; ; ui.grid.pagination&#39;,&#39; ui.grid.grouping&#39;,&#39; ui.grid.cellNav&#39;,&#39; ui.grid.moveColumns&#39;,& #39; ui.grid.exporter&#39;,&#39; ui.grid.pinning&#39;,&#39; ui.grid.resizeColumns&#39;,&#39; ui.grid.selection&#39; ,&#39; ui.grid.autoFitColumns&#39;,&#39; angularjs-dropdown-multiselect&#39;]);
module.controller("SalesOrder",
['$scope', '$filter', '$timeout', '$http', '$interval', 'uiGridConstants', 'uiGridGroupingConstants', '$q',
function ($scope, $filter, $timeout, $http, $q, uiGridConstants, uiGridGroupingConstants, $interval, $window) {