-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
86 lines (73 loc) · 4.15 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<head>
<meta charset="windows-1252">
<title></title>
<!-- Latest jquery file -->
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<!-- Latest compiled and minified CSS -->
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- Angular v 1.2.5 -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<script type="text/javascript" src="vipaginator.js"></script>
<script type="text/javascript">
angular.module('yourapp', ['viPaginator']).controller('yourController', ['$scope', function ($scope) {
$scope.perPage = 1;
$scope.page1ID = 'paginationDiv1';
$scope.paginateItems = [
{"firstName": "Ruhaim", "lastName": "Izmeth"},
{"firstName": "Nuwan", "lastName": "Chamara"},
{"firstName": "Tharindu", "lastName": "Chandrasiri"},
{"firstName": "Kasun", "lastName": "Dharshana"},
{"firstName": "Suresh", "lastName": "Eranda"},
{"firstName": "Damitha", "lastName": "Rathnakara"},
{"firstName": "Susith", "lastName": "Prasanna"},
{"firstName": "Danushka", "lastName": "Thushara"},
{"firstName": "Dulan", "lastName": "Sudasinghe"},
{"firstName": "Dimuth", "lastName": "Vithana"},
{"firstName": "Lahiru", "lastName": "Fernando"},
{"firstName": "Sanjaya", "lastName": "Ruwan"}
];
$scope.page2ID = 'paginationDiv2';
$scope.countUrl = '/vipaginator/getjsoncount.php';
$scope.ajaxUrl = '/vipaginator/getjsonarray.php';
$scope.otherData = {};
$scope.otherData.search = '';
}]);
</script>
</head>
<body ng-app="yourapp">
<div ng-controller="yourController">
<select ng-model="perPage">
<option value="1">1 item</option>
<option value="2">2 item</option>
<option value="3">3 item</option>
</select>
<!--pagination using normal json array without ajax (start)-->
<div class="container">
<div class="row" ng-repeat="item in users" style="border: 1px solid black">
<div class="col-lg-12">
<p style="margin: 10px 0;">{{ item.firstName}} {{ item.lastName}}</p>
</div>
</div>
</div>
<vi-paginator new-array="users" per-page='perPage' div-id="page1ID" items-array='paginateItems'></vi-paginator>
<!--pagination using normal json array without ajax (end)-->
<!--pagination using ajax (start)-->
<div class="form-group">
<label for="usr">Search:</label>
<input type="text" class="form-control" ng-model="otherData.search">
</div>
<div class="container">
<div class="row" ng-repeat="item in ajaxusers" style="border: 1px solid black">
<div class="col-lg-12">
<p style="margin: 10px 0;">{{ item.firstname}} {{ item.lastname}}</p>
</div>
</div>
</div>
<vi-paginator ng-show="ajaxusers" other-data="otherData" new-array="ajaxusers" per-page='perPage' div-id="page2ID" count-url="countUrl" ajax-url="ajaxUrl"></vi-paginator>
<!--pagination using ajax (end)-->
</div>
</body>
</html>