Categories: Php

Datatable Responsive – Using PHP and Mysql with Ajax

I got huge response from datatable tutorials and some users requested share tutorial about responsive datatable. Responsive means a layout which is fit on on each resolution devices like mobile/tablet and desktop which has different resolution screen.

Google also announced that he will give preference those blog/website on search listing which are mobile friendly.You can also check responsiveness of your website/blog using Mozilla/chrome,in Mozilla you can find tool under tools->web developer->responsive design view.

We need two below files to make datatable responsive:

  1. dataTables.responsive.css
  2. dataTables.responsive.js

If you do not know how to use datatable, please read below datatable tutorials:

Datatable Responsive with javaScript and CSS

Step 1: Downloaded above responsiveness file and included into head section of file.

Related Post
<link rel="stylesheet" type="text/css" href="css/dataTables.responsive.css">
<script type="text/javascript" language="javascript" src="js/dataTables.responsive.min.js"></script>

Step 2: Enable responsive property in your existing datatable using 'responsive: true'.

$('#employee_grid').DataTable({
         "bProcessing": true,
         "serverSide": true,
   responsive: true,
         "ajax":{
            url :"response.php", // json datasource
            type: "post",  // type of method  , by default would be get
            error: function(){  // error handling code
              $("#employee_grid_processing").css("display","none");
            }
          }
        });  

The PHP and mysql code are same as previous post,You can download source code and see demo from below link.If you have any queries please share using comment section.

You can download source code and Demo from below link.

View Comments

Recent Posts

What is the Purpose of php_eol in PHP?

in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More

2 months ago

Laravel Table Relationship Methods With Example

This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More

2 months ago

Exploring the Power of Laravel Eloquent Join?

We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More

2 months ago

Quick and Easy Installation of Laravel Valet

in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More

3 months ago

What is Laravel Soft Delete and How Does it Work?

I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More

3 months ago

Common Practices for Laravel Blade Template

in this Laravel tutorial, I will explore common practices for using the Laravel Blade template with examples. Blade is a… Read More

3 months ago

Categories