Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

datatable order number

var table = $('#table').DataTable({
	data: data,
	columns: [
        {data: 'id', title: '#'}, //must have
    ],
  	columnDefs: [{
        sortable: false,
        class:    "index",
        targets:  0
    }],
    order: [[ 0, 'asc' ]],
})

table.on( 'order.dt search.dt', function () {
    table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
      cell.innerHTML = i+1;
    });
}).draw();
Comment

datatable get order column

var table = $('#example').DataTable();

var order = table.order();
alert( 'Table is ordered by column: ' + order[0][0] + ', direction:' + order[0][1]);

var title = table.column(order[0][0]).header();
alert( 'Ordering column title: ' + $(title).html() );
Comment

PREVIOUS NEXT
Code Example
Javascript :: Count of positives / sum of negatives 
Javascript :: canvas js filter greyscale 
Javascript :: chrome.storage.local.remove example 
Javascript :: react js get screen size 
Javascript :: regex find string between two characters 
Javascript :: select text with javascript 
Javascript :: js convert array of arrays to array 
Javascript :: express public folder 
Javascript :: javascript break foreach 
Javascript :: extract payload of expired jwt token in js 
Javascript :: boolean object js 
Javascript :: toast in angular not working 
Javascript :: react capitalize first letter 
Javascript :: change color js 
Javascript :: addclass removeclass jquery 
Javascript :: jquery upload image 
Javascript :: import modules js html 
Javascript :: javascript string to lowercase 
Javascript :: how to convert date format using date pipe in angular 
Javascript :: validate password with 8 Characters, One Uppercase, One Lowercase, One Number and One Special Case Character 
Javascript :: json data sample 
Javascript :: how to check value is array or not in javascript 
Javascript :: math.floor js 
Javascript :: moment get start of week in datetime 
Javascript :: virtual dom explained 
Javascript :: javascript set property for each object in array of objects 
Javascript :: queryselector get each element 
Javascript :: javascript get current date format dd mm yyyy hh mm ss 
Javascript :: data type in javascript 
Javascript :: Javascript replace div content onclick a button 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =