Created
June 24, 2016 11:41
-
-
Save WietseWind/f3c91d4b266aa5467c29510eafc89ab8 to your computer and use it in GitHub Desktop.
Nummeriek NL sorteren in DataTables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aTableExt.oSort["string-nbr-asc"] = function(x,y) {return ((parseFloat(x.replace('.',"").replace(',','.')) < parseFloat(y.replace('.',"").replace(',','.'))) ? -1 : ((parseFloat(x.replace('.',"").replace(',','.')) > parseFloat(y.replace('.',"").replace(',','.'))) ? 1 : 0));}; | |
jQuery.fn.dataTableExt.oSort["string-nbr-desc"] = function(x,y) {return ((parseFloat(x.replace('.',"").replace(',','.')) < parseFloat(y.replace('.',"").replace(',','.'))) ? 1 : ((parseFloat(x.replace('.',"").replace(',','.')) > parseFloat(y.replace('.',"").replace(',','.'))) ? -1 : 0));}; | |
var $dataTableOptions = { | |
'iDisplayLength' : 1000, | |
'lengthMenu' : [ 500,1000,2000 ], | |
'aoColumns' : [ | |
null, | |
null, | |
null, | |
null, | |
null, | |
null, | |
null, | |
{ "sType": "string-nbr" }, | |
null, | |
null | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment