javascript - Datatable sorting is not working for dd-mm-yyyy format -
i want sort date on datatable. want in format d-m-y, doesn't work.
when change format y-m-d works. need in format d-m-y.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#est').datatable({ "bprocessing": true, "bserverside": true, "sajaxsource": '<?php echo base_url(); ?>index.php/welcome/tendersdatatable', "aasorting": [ [3, "desc"] ], "bjqueryui": true, "spaginationtype": "bootstrap", "idisplaystart ": 20, "olanguage": {}, "fninitcomplete": function () { //otable.fnadjustcolumnsizing(); }, 'fnserverdata': function (ssource, aodata, fncallback) { $.ajax({ 'datatype': 'json', 'type': 'post', 'url': ssource, 'data': aodata, 'success': fncallback }); } }); $('.datatables_filter input').addclass('form-control').attr('placeholder', 'search...').css('margin-right', "4%"); $('.datatables_length select').addclass('form-control'); }); </script>
there plugin date-time sorting. source. have moment.js dependancy though.
$.fn.datatable.moment( 'd-m-y');
Comments
Post a Comment