Skip to content

Commit d25c993

Browse files
mportugaSouthpaw17
authored andcommitted
feat(Grid Scrolling): Adds the ability to overwrite default grid scroll event. (#5841)
Creating a wrapper service that takes over the default scrolling logic in order to ensure that grid scrolling works well in devices. Also, adds the ability to the grid to allow users to provide their own custom scrolling.
1 parent c8e1670 commit d25c993

File tree

6 files changed

+725
-5
lines changed

6 files changed

+725
-5
lines changed
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@ngdoc overview
2+
@name Tutorial: 407 Custom Scrolling
3+
@description
4+
5+
<div class="alert alert-info" role="alert"><strong>Note</strong> It is highly recommended that you turn this feature on alongside pinning, especially
6+
if you plan on using ui-grid on devices.</div>
7+
8+
The custom scrolling feature takes over the default scrolling logic in order to ensure that grid scrolling works without a lag on devices.
9+
To enable, you must include the 'ui.grid.customScrolling' module and you must include the ui-grid-custom-scrolling directive on your grid element.
10+
11+
Documentation for the custom scrolling feature is provided in the api documentation, in particular:
12+
13+
- {@link api/ui.grid.customScrolling.constant:uiGridScrollerConstants uiGridScrollerConstants}
14+
- {@link api/ui.grid.customScrolling.service:uiGridScroller uiGridScroller}
15+
- {@link api/ui.grid.customScrolling.directive:uiGridCustomScrolling uiGridCustomScrolling}
16+
17+
@example
18+
<example module="app">
19+
<file name="app.js">
20+
var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.pinning', 'ui.grid.customScrolling']);
21+
22+
app.controller('MainCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) {
23+
$scope.gridOptions = {};
24+
25+
$scope.gridOptions.columnDefs = [
26+
{ name:'id', width:50, enablePinning:false },
27+
{ name:'name', width:100, pinnedLeft:true },
28+
{ name:'age', width:100, pinnedRight:true },
29+
{ name:'address.street', width:150 },
30+
{ name:'address.city', width:150 },
31+
{ name:'address.state', width:50 },
32+
{ name:'address.zip', width:50 },
33+
{ name:'company', width:100 },
34+
{ name:'email', width:100 },
35+
{ name:'phone', width:200 },
36+
{ name:'about', width:300 },
37+
{ name:'friends[0].name', displayName:'1st friend', width:150 },
38+
{ name:'friends[1].name', displayName:'2nd friend', width:150 },
39+
{ name:'friends[2].name', displayName:'3rd friend', width:150 },
40+
];
41+
42+
$http.get('/data/500_complex.json')
43+
.success(function(data) {
44+
$scope.gridOptions.data = data;
45+
});
46+
}]);
47+
</file>
48+
<file name="index.html">
49+
<div ng-controller="MainCtrl">
50+
<div ui-grid="gridOptions" class="grid" ui-grid-pinning ui-grid-custom-scrolling></div>
51+
</div>
52+
</file>
53+
<file name="main.css">
54+
.grid {
55+
width: 100%;
56+
height: 400px;
57+
}
58+
</file>
59+
</example>

0 commit comments

Comments
 (0)