Custom ordering
Custom ordering
norglaw
Posts: 9Questions: 0Answers: 0
Hi,
On Datatables 1.10 I tried to set a custom ordering as seen on the doc, but the filtering is not performed and even the added lines are not read by the program
Did I miss something ?
The columns are set as "french-number" through aoColumnDefs.
Here is the code : $.parseFrenchNumber is a function transforming a french formatted number in a JS Number.
[code]
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"french-number-pre": function ( a ) {
return $.parseFrenchNumber(a);
},
"french-number-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"french-number-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
[/code]
Thank you.
Alban
On Datatables 1.10 I tried to set a custom ordering as seen on the doc, but the filtering is not performed and even the added lines are not read by the program
Did I miss something ?
The columns are set as "french-number" through aoColumnDefs.
Here is the code : $.parseFrenchNumber is a function transforming a french formatted number in a JS Number.
[code]
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"french-number-pre": function ( a ) {
return $.parseFrenchNumber(a);
},
"french-number-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"french-number-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
[/code]
Thank you.
Alban
This discussion has been closed.
Replies
Can you link to a test case showing the issue please (as required in the forum rules)?
Also note that DataTables 1.10 might well have this type of sorting built in using the new `language.decimal` option: http://next.datatables.net/manual/i18n#Ordering-of-numeric-data . It depends upon what you mean by a "french formatted number".
Allan