jQuery Datatables Responsive Using Rest Service and Ajax
source link: https://www.js-tutorials.com/jquery-tutorials/datatables-responsive-using-server-side-and-ajax/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
jQuery Datatables Responsive Using Rest Service and Ajax
I have already shared many jQuery datatables tutorials but now I will let you know, how you can make jQuery datatables responsive. We are creating web applications for web 2.0 so make sure web applications must be responsive.
The datatables responsive means table will adjust the width of table as per different browsers on mobile, tablets and desktop. Its depend upon the screen resolution.
You can see around your workspace or office, there are different resolution desktop available, responsive will help jQuery datatables adjust the width as per viewport
according to device screen width.
jQuery Datatables has many extension for different html table functionality like export, sorting, dynamic width etc. they are providing two extensions to make datatables responsive, one is dataTables.responsive.css
and other one is dataTables.responsive.js
. These datatables libs help to make responsive table.
How to Include jQuery Datatable Library into Application
You can download responsive library files from the below link.
You can also check other tutorials of jQuery datatables,
How to Make jQuery Datatables Responsive
We will include all js and css files into head section of index.html
file.
<script type="text/javascript" language="javascript" src="js/dataTables.responsive.min.js"></script>
Set responsive attribute into jQuery datatables instance
You can enable responsive in your existing jQuery datatables table by adding "responsive: true"
attribute.
$('#photos').DataTable( { "aaData": data, "responsive": true, "dataSrc": function ( json ) { console.log(json); for ( var i=0, ien=json.data.length ; iView message'; } return json.data; } })
The rest of the datatable listing codes are same as previous jQuery datatables tutorial.
You can download source code and Demo from the below link.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK