Skip to content

Commit 3c6fcb4

Browse files
authored
feat(Scrolling): Adding support for a custom scroller. (#5859)
Adding support for providing a custom scroller and a new scroller that makes touch devices scroll without a lag between various pieces of the grid. #1689, #3719, #5833
1 parent 28d582a commit 3c6fcb4

File tree

4 files changed

+477
-3
lines changed

4 files changed

+477
-3
lines changed

grunt/karma.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var util = require('../lib/grunt/utils.js');
33
module.exports = function( grunt ){
44
var baseConfig = {
55
options: {
6-
configFile: 'test/karma.debug.conf.js',
6+
configFile: 'test/karma.conf.js',
77
background: true,
88
},
99
// dev: {
+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)