DataTable filters,pagination,search is not working
DataTable filters,pagination,search is not working
sinthis
Posts: 1Questions: 1Answers: 0
I'm using Datatable jquery plugin to achieve individual column filter, pagination but its not working.
I've added the below files,
1)jquery.dataTables.js
2)jquery.dataTables.min.css
and my code is,
<table id="tcExecDetails" class="display" style= "width:85%;font-size:11px;">
<thead>
<tr class="success">
<th>Execution Id</th>
<th>Test Case Name</th>
<th>Start Time</th>
<th>Actual End Time</th>
<th>Planned End Time</th>
<th>Execution Type</th>
<th class="status">Status</th>
</tr>
</thead>
<tbody id='tcExecDetailsTable' class="alt_content" >
</tbody>
</table>
jquery
$('#tcExecDetails').DataTable( {
initComplete: function () {
this.api().columns().every( function () {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
} );
This discussion has been closed.