Skip to content

Server pagination #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 4, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Was added documentation for server pagination.
  • Loading branch information
skozlov committed Jun 14, 2016
commit 7f07d07c7aabc1ad184b13df8a177ba049b46906
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ Direct download: get ZIP archive [from here](https://github.com/angular-data-gri
Then use files from *dist* folder (see below).

### Setup
1. Include scripts in you application: `dataGrid.min.js` and `pagination.min.js` (include the second one only if you need pagination).
1. Include scripts in you application: `angular.min.js`, `dataGrid.min.js` and `pagination.min.js` (include the second one only if you need pagination).

```javascript
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="bower_components/angular-data-grid/dist/pagination.min.js"></script>
<script src="bower_components/angular-data-grid/dist/dataGrid.min.js"></script>
```
Expand Down Expand Up @@ -105,7 +106,10 @@ Use this object for calling methods of directive: `sort()`, `filter()`, `refresh
};
```

- For server side pagination/filtering to fetch data by page: assign ```getData``` method to some function with URL params as 1st parameter and data itself as 2d parameter:
- For server side pagination/filtering to fetch data by page:
1. add attribute 'server-pagination'=true on element on which you applied directive 'grid-data'
2. assign ```getData``` method to some function with URL params as 1st parameter and data itself as 2d parameter:


```javascript
$scope.gridOptions = {
Expand Down Expand Up @@ -145,7 +149,7 @@ $scope.gridOptions = {

### Pagination

You can optionally use `pagination` directive to display paging with previous/next and first/last controls.
You can optionally use `grid-pagination` directive to display paging with previous/next and first/last controls.
Directive is built on a base of excellent [Angular UI](https://angular-ui.github.io/bootstrap/) component and shares extensive API:

```HTML
Expand Down
5 changes: 4 additions & 1 deletion demo/bootstrap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ <h4>Additional Demos</h4>
<li>
<a href="multiple.html" target="_blank">Multiple grids on page</a>
</li>
<li>
<a href="server-pagination.html" target="_blank">Server pagination</a>
</li>
</ul>
<hr>
<div class="row">
Expand Down Expand Up @@ -168,7 +171,7 @@ <h4>Additional Demos</h4>
ng-model="status"
ng-change="filter()">
<option value="">All Statuses</option>
<option ng-repeat="option in UI.statusOptions track by option.value"
<option ng-repeat="option in statusOptions track by option.value"
value="{{option.value}}">{{option.text}}
</option>
</select>
Expand Down
18 changes: 16 additions & 2 deletions demo/bootstrap/server-pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,21 @@
<link rel="stylesheet" href="css/angular-data-grid.bootstrap.css">
</head>
<body ng-controller="myAppController">
<nav class="navbar navbar-inverse">
<div class="container">
<a href="#" class="navbar-brand">Angular Data Grid - Server Pagination</a>
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html">Back to main demo</a></li>
</ul>
</div>
</nav>
<div class="container">
<div class="margin-bottom-basic">
<h3>Angular Data Grid Server Pagination</h3>
Features enabled: sorting, filtering (using both in-grid and external controls), pagination and items-per-page functionality.
Angular UI Datepicker used for date controls, although you can use any other framework, plugin or styling.
<a href="https://github.com/angular-data-grid/angular-data-grid.github.io" target="_blank">Project GitHub</a>
</div>
<hr>
<div class="row">
<div>
Expand Down Expand Up @@ -202,7 +216,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.3.js"></script>

<script src="../../dist/pagination.js"></script>
<script src="../../dist/dataGrid.js"></script>
<script src="../../dist/pagination.min.js"></script>
<script src="../../dist/dataGrid.min.js"></script>
<script src="js/serverPaginationApp.js"></script>
</html>
5 changes: 0 additions & 5 deletions dist/dataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@
}
});

if (!$scope.serverPagination) {
applyCustomFilters();
}


//pagination options
$scope.paginationOptions.itemsPerPage = $scope.defaultsPaginationOptions.itemsPerPage;
$scope.paginationOptions.currentPage = $scope.defaultsPaginationOptions.currentPage;
Expand Down
2 changes: 1 addition & 1 deletion dist/dataGrid.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/js/dataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@
}
});

if (!$scope.serverPagination) {
applyCustomFilters();
}


//pagination options
$scope.paginationOptions.itemsPerPage = $scope.defaultsPaginationOptions.itemsPerPage;
$scope.paginationOptions.currentPage = $scope.defaultsPaginationOptions.currentPage;
Expand Down