How to sort and paginate the table, Please its very urgent, help me [Resolved]

Posted by Tsurendra690-29180 under AngularJS on 1/19/2017 | Points: 10 | Views : 674 | Status : [Member] | Replies : 2
How to sort and paginate the following table, could you please explain friends
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<script>
$(document).ready(function () {
$(".col1").click(function () {
$(".col2").toggle(1000);
});
});
</script>
<script>
var app = angular.module('myapp', []);
app.controller('myctrl', function ($scope) {
$scope.collection = [
{ Google: 'Dhoni', Facebook: 'Simla', Twitter: '5000' },
{ Google: 'Kohli', Facebook: 'Manali', Twitter: '15000' },
{ Google: 'Virat', Facebook: 'Rajasthan', Twitter: '35000' },
{ Google: 'Yuvraj', Facebook: 'Kerala', Twitter: '35000' },
{ Google: 'Singh', Facebook: 'Mysore', Twitter: '35000' },
{ Google: 'Murali', Facebook: 'OOTY', Twitter: '20000' },
{ Google: 'Vijay', Facebook: 'Goa', Twitter: '20000' }
];
//Object to hold user input
$scope.userInput = {};
//fetch the value and assign to UserInput variable
$scope.search = function (event) {
if (event.keyCode == 13) {
$scope.userInput = $scope.Google;
}
}
});
</script>
</head>
<body ng-app="myapp">
<div ng-controller="myctrl">
<input type="text" class="form-control" name="search" placeholder="Enter keyword to search" ng-model="Google" ng-keyup="search($event)" style="background-color:#5b2c2c;color:white;">
<input type="button" value="Search" ng-click="search()">
<table class="table" border="1" style="margin:0;margin-left:90px;background-color:white;width:80%;border:5px solid green">
<thead>
<tr>
<th class="col1"><a>Google</a></th>
<th class="col2"><a>Facebook</a></th>
<th class="col2"><a>Twitter</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="record in collection | filter:userInput" ng-class-even="'stripped'">
<td >{{record.Google}}</td>
<td class="col2">{{record.Facebook}}</td>
<td class="col2">{{record.Twitter}}</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>





Responses

Posted by: Manideepgoud on: 1/26/2017 [Member] Starter | Points: 50

Up
0
Down

Resolved
Dear Tsurendra690-29180
To paginate following table , we have to install the following dir-paginate link in the
<script></script>

tag, Here is the following link
https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination

In the First step
Add link in the script tag
<script src="https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination "></script>

In the Second step
Add paginatiion controls
<dir-pagination-controls max-size="5"

direction-links="true"
boundary-links="true">
</dir-pagination-controls>

In the last step
Add
'angularUtils.directives.dirPagination'
in the module.
var app = angular.module("angularTable", ['angularUtils.directives.dirPagination']);


Tsurendra690-29180, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Manideepgoud on: 1/23/2017 [Member] Starter | Points: 25

Up
0
Down

Login to post response