Trying to sort column with hebrew strings
Trying to sort column with hebrew strings
soda99
Posts: 1Questions: 0Answers: 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:
[code]
$.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));
}
});
[/code]
and in the datatable settings i added this:
[code]
"aoColumns": [
{ "sClass": "table_more_details", "bSortable": false },
{ "sClass": "delivery_status" },
{"sType": "heb" },
{"sType": "heb" },
{"sType": "heb" },
{"sType": "heb" },
{"sType": "heb" },
null
],
[/code]
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
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:
[code]
$.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));
}
});
[/code]
and in the datatable settings i added this:
[code]
"aoColumns": [
{ "sClass": "table_more_details", "bSortable": false },
{ "sClass": "delivery_status" },
{"sType": "heb" },
{"sType": "heb" },
{"sType": "heb" },
{"sType": "heb" },
{"sType": "heb" },
null
],
[/code]
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
This discussion has been closed.