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 infinityknow.com – 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!.

Example

live_angular_datatable.sql

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

READ :  Angularjs math expression - number expressions Example

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
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Indexes for table `client_list`
------------------------------
ALTER TABLE `client_list`
  ADD PRIMARY KEY (`id`);

index.php



  <title>live24u | AngularJS Sorting, Searching and Pagination of Data Table using PHP, MySQL</title>
    
    
    


    <div>
        <div class="container">
            <hr />
            <h2 align="center">Step By step AngularJS Searching Sorting and Pagination of Data Table using PHP and MySQL Created By infinityknow.com</a></h2>
            <hr />
            <div class="row">
                <div class="col-md-2 pull-left">
                    <label>Live PageSize:</label>
                    
                        10
                        20
                        50
                        100
                    
                </div>
                <div class="col-md-6 pull-right">
                    <label>Search:</label>
                    
                </div>
            </div>
            <hr />
			<!-- All list of client data list-->
            <div class="row">
                <div class="col-md-12"> 0">
                    <table class="table">
                        <thead>
                            <th>CLient Name<a><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Gender<a><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Age<a><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Email<a><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Phone<a><i class="glyphicon glyphicon-sort"></i></a></th>
                            <th>CLient Organization<a><i class="glyphicon glyphicon-sort"></i></a></th>
                        </thead>
                        <tbody>
                            <tr>
                                <td>{{cdata.name}}</td>
                                <td>{{cdata.client_gen}}</td>
                                <td>{{cdata.client_age}}</td>
                                <td>{{cdata.email}}</td>
                                <td>{{cdata.client_phone}}</td>
                                <td>{{cdata.comapny_org}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
				<!-- Show message if no found any data records -->
                <div class="col-md-12">
                    <div class="col-md-12">
                        <h4>No records found..</h4>
                    </div>
                </div>
				<!-- 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>
                    <div class="col-md-6"> 0">
                        <div class="pagination-mdall pull-right"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	<!-- Include External Libs -->
    <a href="http://angular.min.js">http://angular.min.js</a>
    <a href="http://ui-bootstrap-tpls.min.js">http://ui-bootstrap-tpls.min.js</a>
    <a href="http://liveapp.js">http://liveapp.js</a>


client_fetch.php

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;
?>

liveapp.js

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;
    };
});

Example

READ :  C# pointers Tutorial with Examples

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(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

https://pakainfo.com/

Add a Comment

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