Send click event
Send click event
Hello
Im loading the dataTable script when I click a sortable column like this
$('.tables th').click(function(){
$('.tables').dataTable();
});
The problem is I want to both excecute the dataTable script and pass the click event to the .tables th to sort the column. But I have to click one more time on the column to do this.
Hope it makes sense.
Im loading the dataTable script when I click a sortable column like this
$('.tables th').click(function(){
$('.tables').dataTable();
});
The problem is I want to both excecute the dataTable script and pass the click event to the .tables th to sort the column. But I have to click one more time on the column to do this.
Hope it makes sense.
This discussion has been closed.
Replies
$('.tables th').one("click", function() {
$('.tables').dataTable();
});
[code]
$(document).ready(function() {
$('.tables th').one("click", function() {
var table = $('.tables').dataTable();
table.fnSort( [ [0,'asc'], [1,'asc'] ] );
});
[/code]
Im not sure if this example pvovides a solution http://datatables.net/release-datatables/examples/advanced_init/dt_events.html