$(document).ready(function() {
$.fn.dataTable.ext.order['sortMln'] = function ( settings, col )
{
return this.api().column( col, {order:'index'} ).nodes().map( function ( td ) {
return 1*$(td).text().replace(' млн.', '');
} );
};
$.fn.dataTable.ext.order['sortCountryFlag'] = function ( settings, col )
{
return this.api().column( col, {order:'index'} ).nodes().map( function ( td ) {
return $('span', td).attr('title');
} );
};
$.fn.dataTable.ext.order['sortMostPopular'] = function ( settings, col )
{
return this.api().column( col, {order:'index'} ).nodes().map( function ( td ) {
return 1*$(td).text().substr(0,$(td).text().indexOf("x")-1);
} );
};
$('table', '#tablePopular').dataTable( {
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"bAutoWidth": false,
"aoColumns": [
null,
{ sType : "text" },
null,
{ "sSortDataType": "sortMln", "sType": "numeric" }, { "sSortDataType": "sortMostPopular", "sType": "numeric" }
]
} );
} );