Custom ordering

Custom ordering

norglawnorglaw Posts: 9Questions: 0Answers: 0
edited April 2014 in DataTables 1.10
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

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Alban,

    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
This discussion has been closed.