Can't log custom sorting

Can't log custom sorting

pgrobbanpgrobban Posts: 2Questions: 1Answers: 0

Hi,
I'm trying to implement a custom Swedish sort function to my table. The Swedish alphabet extends the English one by appending the three letters åäö (ÅÄÖ in uppercase), in this precise order.

I did this by overriding jQuery.fn.dataTableExt.oSort['string-case-asc'] and having it return x.localeCompare(y, 'sv');
So far, so good. However, now I want to modify the sorting a bit by ignoring the articles "en/ett" which can be seen as articles like "a" or "an" in front of nouns in English. So "en apa" should be treated the same as "apa", and thus come before "arbeta".

I'm still getting the old sorting (that's not the important bit here, though). What I'm asking is why I'm not getting any output in the log?

I can set up a live table for testing but here's the relevant function in my code:

jQuery.fn.dataTableExt.oSort['string-case-asc'] = function (x, y) {
    x = x.replace(/\(?(en|ett)\)? /i, "");
    y = y.replace(/\(?(en|ett)\)? /i, "");
    console.log(x + " " + y);
    return x.localeCompare(y, 'sv');
};

Answers

  • pgrobbanpgrobban Posts: 2Questions: 1Answers: 0
    edited March 2015

    Solved by wrapping everything into jQuery.extend

This discussion has been closed.