javascript - DataTables cannot reinitialize or plugin is required -


i having problem of making last login column sort descending
datatables automatically sort data ascending order of first column

this structure

<script src="<?php echo base_url()?>js/datatables.js"></script> <script>         $(document).ready(function() {      $('#example9').datatable({         "order": [2,'desc'] }); }); </script> 

there error saying table_id="#example9" cannot reinitialize sorting works. when remove datatables.js different error appear datatables plugin required. how can solve ? advance thank you.

in datatable, use aasorting sort data based on particular column. can use aasorting during initialization of datatable

$('table').datatable({     // display     "aasorting": [[ 0, "desc" ]] // sort first column descending });  

here 0 refers column number left. first column treated 0 , on.you can use asc or desc order column.

you can read more such operation here.

error datatable cannot reinitialize means initialising yout dt multiple times. check whether dt initialised earlier or not

if ( ! $.fn.datatable.isdatatable( '#example' ) ) {   $('#example').datatable(); } 

read more here.

you can hide error screen appear on console using

$.fn.datatableext.serrmode = 'throw';  

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -