Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

Trying to sort column with hebrew strings

$
0
0
hi.
i have a problem that i cant resolve and I've been trying for quite a while now
(sorry about my English. its not my mother-tongue)
so here's the thing
i'm trying to add a new sort function to oSort that will sort the Hebrew strings because i couldn't make it sort with the regular built in sort
i'm adding the new sort like this:
$.extend( $.fn.dataTableExt.oSort, {
   "heb-asc": function(x,y) {
     charstring = '0134567890אבגדהוזחטיכךלמםנןסעפףצץקרשת';
      return ((charstring.indexOf(x) < charstring.indexOf(y)) ? -1 : ((charstring.indexOf(x) > charstring.indexOf(y)) ?  1 : 0));
    },
    "heb-desc": function(x,y) {
      console.log("ok");
      charstring = '0134567890אבגדהוזחטיכךלמםנןסעפףצץקרשת';
      return ((charstring.indexOf(x) < charstring.indexOf(y)) ? 1 : ((charstring.indexOf(x) > charstring.indexOf(y)) ?  -1 : 0));
    }
});

and in the datatable settings i added this:
"aoColumns": [
            { "sClass": "table_more_details", "bSortable": false },
            { "sClass": "delivery_status" },
            {"sType": "heb" },
            {"sType": "heb" },
            {"sType": "heb" },
            {"sType": "heb" },
            {"sType": "heb" },
            null         
 ],

when i click on the header it says that its updating the table but nothing happens
i added console.log inside the functions but it seems that the functions are not being called at all
please help a desperate man :-)
thanks

Viewing all articles
Browse latest Browse all 1816