Skip to content
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

Paddings #77

Merged
merged 10 commits into from
Apr 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 11 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ <h1 class="page-header">Scroller Examples</h1>
Top visible (Adapter)
</a>
</li>
<li>
<a href="reload100/reload100.html">
Reload datasource to specified index
</a>
</li>
<li>
<a href="userIndexes/userIndexes.html">
Manipulate start and end indexes outside the directive
</a>
</li>
<li>
<a href="visibility/visibility.html">
Visibility
Expand Down Expand Up @@ -104,7 +114,7 @@ <h1 class="page-header">Scroller Examples</h1>
<div class="more-wrap">
<a href="https://github.com/angular-ui/ui-scroll/">read more...</a>
</div>

</div>
</body>
</html>
36 changes: 36 additions & 0 deletions demo/reload100/reload100.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Reload 100</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
<script src="../../dist/ui-scroll.js"></script>
<script src="../../dist/ui-scroll-jqlite.js"></script>
<script src="reload100.js"></script>
<link rel="stylesheet" href="../css/style.css" type="text/css"/>
</head>
<body ng-controller="mainController" ng-app="application">

<div class="cont cont-global">

<a class="back" href="../index.html">browse other examples</a>

<h1 class="page-header page-header-exapmle">Reload with parameter</h1>

<div class="description">
Here we provide an ability to reload the datasource to some specified position.
</div>

<div class="actions" ng-init="reloadIndex = 100">
<input ng-model="reloadIndex" size="2"> - index to reload <br>
<button ng-click="doReload(reloadIndex)"> Reload({{reloadIndex}}) </button>
</div>

<div ng-if="delay" class="viewport" id="viewport-serviceDatasource" ui-scroll-viewport>
<div class="item" ui-scroll="item in datasource" adapter="adapter">{{item}}</div>
</div>

</div>

</body>
</html>
33 changes: 33 additions & 0 deletions demo/reload100/reload100.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
.controller('mainController', [
'$scope', '$log', '$timeout', function ($scope, console, $timeout) {
var datasource = {};

datasource.get = function (index, count, success) {
$timeout(function () {
var result = [];
for (var i = index; i <= index + count - 1; i++) {
result.push("item #" + i);
}
success(result);
}, 100);
};

$scope.datasource = datasource;
$scope.adapter = {};

$scope.doReload = function () {
if (angular.isFunction($scope.adapter.reload)) {
var reloadIndex = parseInt($scope.reloadIndex, 10);
reloadIndex = isNaN(reloadIndex) ? 1 : reloadIndex;
$scope.adapter.reload(reloadIndex);
}
};

$scope.delay = false;
$timeout(function() {
$scope.delay = true;
}, 500);

}
]);
2 changes: 1 addition & 1 deletion demo/topVisible/topVisible.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1 class="page-header page-header-exapmle">Top visible</h1>
</div>

<div class="viewport" id="viewport-persistentScroll" ui-scroll-viewport>
<div class="item" ui-scroll="item in datasource" top-visible="topVisible">{{$index}}: {{item}}</div>
<div class="item" ui-scroll="item in datasource" buffer-size="40" top-visible="topVisible">{{$index}}: {{item}}</div>
</div>

</div>
Expand Down
48 changes: 48 additions & 0 deletions demo/userIndexes/userIndexes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User min and max indexes</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
<script src="../../dist/ui-scroll.js"></script>
<script src="../../dist/ui-scroll-jqlite.js"></script>
<script src="userIndexes.js"></script>
<link rel="stylesheet" href="../css/style.css" type="text/css"/>
<style type="text/css">
button {
width: 180px;
margin-bottom: 3px;
margin-right: 7px;
}
</style>
</head>
<body ng-controller="mainController" ng-app="application">

<div class="cont cont-global">

<a class="back" href="../index.html">browse other examples</a>

<h1 class="page-header page-header-exapmle">Set user min and max indexes</h1>

<div class="description">
Here we provide an ability of external min and max indexes setting to let the viewport know how many items do we have.
</div>

<div class="actions" ng-init="userMinIndex = -100; userMaxIndex = 100">
<button ng-click="setUserMinIndex()"> Set minIndex = {{userMinIndex}} </button>
<input ng-model="userMinIndex" size="2"> minIndex value to set
<br>
<button ng-click="setUserMaxIndex()"> Set maxIndex = {{userMaxIndex}} </button>
<input ng-model="userMaxIndex" size="2"> maxIndex value to set
<br>
<button ng-click="setUserIndexes()"> Set both Indexes </button>
</div>

<div ng-if="delay" class="viewport" id="viewport-serviceDatasource" ui-scroll-viewport>
<div class="item" ui-scroll="item in datasource" adapter="adapter">{{item}}</div>
</div>

</div>

</body>
</html>
42 changes: 42 additions & 0 deletions demo/userIndexes/userIndexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
.controller('mainController', [
'$scope', '$log', '$timeout', function ($scope, console, $timeout) {
var datasource = {};

datasource.get = function (index, count, success) {
$timeout(function () {
var result = [];
for (var i = index; i <= index + count - 1; i++) {
result.push("item #" + i);
}
success(result);
}, 100);
};

$scope.datasource = datasource;
$scope.adapter = {};

$scope.setUserMinIndex = function () {
var userMinIndex = parseInt($scope.userMinIndex, 10);
if(!isNaN(userMinIndex))
$scope.datasource.minIndex = userMinIndex;
};

$scope.setUserMaxIndex = function () {
var userMaxIndex = parseInt($scope.userMaxIndex, 10);
if(!isNaN(userMaxIndex))
$scope.datasource.maxIndex = userMaxIndex;
};

$scope.setUserIndexes = function () {
$scope.setUserMinIndex();
$scope.setUserMaxIndex();
};

$scope.delay = false;
$timeout(function() {
$scope.delay = true;
}, 500);

}
]);
2 changes: 1 addition & 1 deletion dist/ui-scroll-jqlite.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* angular-ui-scroll
* https://github.com/angular-ui/ui-scroll.git
* Version: 1.4.0 -- 2016-04-04T13:10:12.966Z
* Version: 1.4.0 -- 2016-04-04T13:14:46.276Z
* License: MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion dist/ui-scroll-jqlite.min.js

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

Loading