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:
If you do not know how to use datatable, please read below datatable tutorials:
- Part 1: Introduction of Datatable
- Part 2- DataTables Example – Server-side Processing with PHP
- Part 3 – How to add RowId and RowClass on each record using Datatable
- Part 4 – Datatable Pagination, Sorting and Search – Server Side (PHP/MySQl) Using Ajax
- Part5 – Export the jQuery Datatable data to PDF,Excel,CSV and Copy
- Part 6 – Datatable Responsive – Using PHP and Mysql with Ajax
Datatable Responsive with javaScript and CSS
Step 1: Downloaded above responsiveness file and included into head section of file.
<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.
Great datatable tuts, could you show a example with the export buttons? https://editor.datatables.net/examples/advanced/exportButtons.html
Thanks Neil, I will post soon about datatable export features.
Thanks Neil, I will post soon about datatable export features.
Hi Neil, I have posted article as per your requirement.
https://phpflow.com/php/how-to-export-the-jquery-datatable-data-to-pdf-excel-csv-and-copy/
Hi, I want command button like Update/Delete in Boot Grid. and also want to display image.with php ajax
just add a column with update/delete icon like other html table
where is the download links, btw i have shared this tutor. thanks
After share article,u can get dwnloded link
but the share button is not available….
I sent code ur mail.
For display on the Iphone,
Don’t forget to add in the file index.php the line:
you can get help from https://phpflow.com/php/parse-json-data-jquery-datatable/
Hi,
Could someone please help me.
I would like to add the modal function “edit” and “cancel” to this script for each savings.
Unfortunately, I can’t find an adequate solution
Did someone already add this function et could communicate it to me.
Thank you.