/////////// There are multiple types of the features in the jquery -
------- Js Plugin --
--------- Call Function--
Sequence----
1. == > Extension
2. == > Datatable.html
3. == > Datatable.js
------- Js Plugin --
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
jQuery.extend(jQuery.fn.dataTableExt.oSort,
{
"date-eu-pre": function (date) {
date = date.replace(" ", "");
if (!date) {
return 0;
}
var year;
var eu_date = date.split(/[\.\-\/]/);
/*year
(optional)*/
if (eu_date[2]) {
year = eu_date[2];
}
else {
year = 0;
}
/*month*/
var month = eu_date[1];
if (month.length == 1) {
month = 0 + month;
}
/*day*/
var day = eu_date[0];
if (day.length == 1) {
day = 0 + day;
}
return (year + month + day) * 1;
},
"date-eu-asc": function (a, b) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-eu-desc": function (a, b) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
--------- Call Function--
//// Example
//
$('#example').dataTable( {
// columnDefs: [
// { type: 'date-eu', targets: 0 }
// ]
//});
Sequence----
1. == > Extension
2. == > Datatable.html
3. == > Datatable.js
No comments:
Post a Comment