Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Created June 24, 2016 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WietseWind/f3c91d4b266aa5467c29510eafc89ab8 to your computer and use it in GitHub Desktop.
Save WietseWind/f3c91d4b266aa5467c29510eafc89ab8 to your computer and use it in GitHub Desktop.
Nummeriek NL sorteren in DataTables
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