Angular UI-Grid 3.0.0-rc.16:分页对我不起作用
Angular UI-Grid 3.0.0-rc.16: Pagination not working for me
我有一个非常简单的网格,我正在尝试启用分页,但没有出现分页控件。这是我拥有的:
我已将 'ui.grid.pagination' 添加为对我的应用程序模块的依赖。
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>'
}
]
};
分页在RC 16中不可用,你应该使用最新的不稳定版本。
https://github.com/angular-ui/ng-grid/issues/2479
编辑:
作为一个不稳定的版本,我认为没有包含在可用版本中,实际上当 运行 bower info angular-ui-grid
时,我看到:
Available versions:
- 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
模块=angular.module('app',
['ngTouch', 'ui.grid', 'ui.grid.edit', 'ui.grid.autoResize', 'ui.grid.pagination', 'ui.grid.grouping', 'ui.grid.cellNav', 'ui.grid.moveColumns', 'ui.grid.exporter', 'ui.grid.pinning', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ui.grid.autoFitColumns', 'angularjs-dropdown-multiselect']);
module.controller("SalesOrder",
['$scope', '$filter', '$timeout', '$http', '$interval', 'uiGridConstants', 'uiGridGroupingConstants', '$q',
function ($scope, $filter, $timeout, $http, $q, uiGridConstants, uiGridGroupingConstants, $interval, $window) {
我有一个非常简单的网格,我正在尝试启用分页,但没有出现分页控件。这是我拥有的:
我已将 'ui.grid.pagination' 添加为对我的应用程序模块的依赖。
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>'
}
]
};
分页在RC 16中不可用,你应该使用最新的不稳定版本。
https://github.com/angular-ui/ng-grid/issues/2479
编辑:
作为一个不稳定的版本,我认为没有包含在可用版本中,实际上当 运行 bower info angular-ui-grid
时,我看到:
Available versions:
- 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
模块=angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.edit', 'ui.grid.autoResize', 'ui.grid.pagination', 'ui.grid.grouping', 'ui.grid.cellNav', 'ui.grid.moveColumns', 'ui.grid.exporter', 'ui.grid.pinning', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ui.grid.autoFitColumns', 'angularjs-dropdown-multiselect']);
module.controller("SalesOrder",
['$scope', '$filter', '$timeout', '$http', '$interval', 'uiGridConstants', 'uiGridGroupingConstants', '$q',
function ($scope, $filter, $timeout, $http, $q, uiGridConstants, uiGridGroupingConstants, $interval, $window) {