Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82019

fnSorting does not work

$
0
0
I would like to configure client side sorting.
But I do not succeed in running fnSort.

I get data via ajax (static data for dev purpose), and I bind the fnSort to the th click event:

, "sAjaxSource": "data/data.txt"
, "fnHeaderCallback" : function(nHead, aData, iStart, iEnd, aiDisplay){
	var ths = $(nHead).find('th');
	for(i = 0; i<ths.length; i++){
		var $thsi = $(ths[i]);
		$thsi.unbind('click').click({"index" : i}, function(e){
			$table.fnSort( [ [e.data.index, 'asc'] ] );
		});
	}
}

Data are correctly displayed, click handlers is correctly bound. I have also checked that oSettings.aaSorting has been changed. But no sort occurs.

Besides this, the "click event" is bound once more each time fnHeaderCallback runs. I hacked this using the unbind method before the click method. Why do multiple bindings occur?

Viewing all articles
Browse latest Browse all 82019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>