Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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();
 
PREVIOUS NEXT
Tagged: #datatable #order #number
ADD COMMENT
Topic
Name
6+3 =