AngularJS Searching Sorting Pagination with DataTable using PHP And MySQL

AngularJS Searching Sorting Pagination with DataTable using PHP And MySQL

In this Post We Will Explain About is AngularJS Searching Sorting Pagination with DataTable using PHP And MySQL With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to AngularJS Datatable Pagination, Sorting and Search – Server SideExample

In this post we will show you Best way to implement Pagination, Searching and Sorting of Data Table using AngularJS, hear for CRUD, Paging, Sorting, Searching with AngularJS in MVCwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.



Table structure for table `client_list` as well as Indexes for table `client_list`

CREATE TABLE `client_list` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `client_gen` varchar(10) NOT NULL,
  `client_age` varchar(15) NOT NULL,
  `email` varchar(255) NOT NULL,
  `client_phone` varchar(15) NOT NULL,
  `comapny_org` varchar(255) NOT NULL

Indexes for table `client_list`
ALTER TABLE `client_list`


<!doctype html>
  <title>live24u | AngularJS Sorting, Searching and Pagination of Data Table using PHP, MySQL</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="bootstrap.min.css" rel="stylesheet">
    <div ng-app="liveApp" ng-controller="controller">
        <div class="container">
            <h2 align="center">Step By step AngularJS Searching Sorting and Pagination of Data Table using PHP and MySQL Created By</a></h2>
            <div class="row">
                <div class="col-md-2 pull-left">
                    <label>Live PageSize:</label>
                    <select ng-model="total_limit" class="form-control">
                        <option value="">10</option>
                        <option value="">20</option>
                        <option value="">50</option>
                        <option value="">100</option>
                <div class="col-md-6 pull-right">
                    <input type="text" ng-model="search" ng-change="filter()" placeholder="Please Search Client" class="form-control" />
			<!-- All list of client data list-->
            <div class="row">
                <div class="col-md-12" ng-show="filter_data > 0">
                    <table class="table">
                            <th>CLient Name<a ng-click="client_sort_data('name');"><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Gender<a ng-click="client_sort_data('client_gen');"><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Age<a ng-click="client_sort_data('client_age');"><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Email<a ng-click="client_sort_data('email');"><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Phone<a ng-click="client_sort_data('client_phone');"><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Organization<a ng-click="client_sort_data('comapny_org');"><i class="glyphicon glyphicon-sort"></i></a></th>
                            <tr ng-repeat="cdata in client_search = (file | filter:search | orderBy : base :reverse) | beginning_data:(live_grid_data-1)*total_limit | limitTo:total_limit">
				<!-- Show message if no found any data records -->
                <div class="col-md-12" ng-show="filter_data == 0">
                    <div class="col-md-12">
                        <h4>No records found..</h4>
				<!-- Show pagination data records -->
                <div class="col-md-12">
                    <div class="col-md-6 pull-left">
                        <h5>Showing {{ client_search.length }} of {{ total_users}} entries</h5>
                    <div class="col-md-6" ng-show="filter_data > 0">
                        <div pagination="" page="live_grid_data" on-select-page="pos_page(page)" boundary-links="true" total-items="filter_data" items-per-page="total_limit" class="pagination-mdall pull-right" previous-text="«" next-text="»"></div>
	<!-- Include External Libs -->
    <script src="angular.min.js"></script>
    <script src="ui-bootstrap-tpls.min.js"></script>
    <script src="liveapp.js"></script>


$conn  = new mysqli('localhost', 'root', '', 'live_angular_datatable');
$live_query = "select distinct name, client_gen, client_age, email, client_phone, comapny_org from client_list order by id";
$sql_result = $conn->query($live_query) or die($conn->error . __LINE__);
$fetch_data = array();
if ($sql_result->num_rows > 0) {
    while ($data_row = $sql_result->fetch_assoc()) {
        $fetch_data[] = $data_row;
$sql_resdata = json_encode($fetch_data);
echo $sql_resdata;


var liveApp = angular.module('liveApp', ['ui.bootstrap']);
liveApp.filter('beginning_data', function() {
    return function(input, begin) {
        if (input) {
            begin = +begin;
            return input.slice(begin);
        return [];
liveApp.controller('controller', function($scope, $http, $timeout) {
    $http.get('client_fetch.php').success(function(client_list) {
        $scope.file = client_list;
        $scope.live_grid_data = 1;
        $scope.total_limit = 10;
        $scope.filter_data = $scope.file.length;
        $scope.total_users = $scope.file.length;
    $scope.pos_page = function(parm_pageno) {
        $scope.live_grid_data = parm_pageno;
    $scope.filter = function() {
        $timeout(function() {
            $scope.filter_data = $scope.client_search.length;
        }, 20);
    $scope.client_sort_data = function(base) {
        $scope.base = base;
        $scope.reverse = !$scope.reverse;


READ :  Vue js First Application Example with vue mvc

I hope you have Got What is PHP AngularJS CRUD with Search and Pagination Example And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *