|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
* @name Persian
|
|
|
|
|
* @summary Sort Persian strings alphabetically
|
|
|
|
|
* @author [Afshin Mehrabani](http://www.afshinblog.com/)
|
|
|
|
|
* @author [Mohammad Javad Naderi](https://github.com/mjnaderi)
|
|
|
|
|
*
|
|
|
|
|
* @example
|
|
|
|
|
* $('#example').dataTable( {
|
|
|
|
@ -26,25 +27,27 @@ function GetUniCode(source) {
|
|
|
|
|
var i, index;
|
|
|
|
|
for (i = 0; i < source.length; i++) {
|
|
|
|
|
//Check and fix IE indexOf bug
|
|
|
|
|
if (!Array.indexOf) {
|
|
|
|
|
if (!Array.indexOf)
|
|
|
|
|
index = jQuery.inArray(source.charAt(i), persianSort);
|
|
|
|
|
}else{
|
|
|
|
|
else
|
|
|
|
|
index = persianSort.indexOf(source.charAt(i));
|
|
|
|
|
}
|
|
|
|
|
if (index < 0) {
|
|
|
|
|
index = source.charCodeAt(i);
|
|
|
|
|
}
|
|
|
|
|
if (index < 10) {
|
|
|
|
|
|
|
|
|
|
if (index < 0)
|
|
|
|
|
index = source.charCodeAt(i) + 40;
|
|
|
|
|
|
|
|
|
|
if (index < 10)
|
|
|
|
|
index = '00' + index;
|
|
|
|
|
else if (index < 100)
|
|
|
|
|
index = '0' + index;
|
|
|
|
|
}
|
|
|
|
|
result += '00' + index;
|
|
|
|
|
|
|
|
|
|
result += index;
|
|
|
|
|
}
|
|
|
|
|
return 'a' + result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
|
|
|
|
|
"pstring-pre": function (a) {
|
|
|
|
|
return GetUniCode(a.toLowerCase());
|
|
|
|
|
return GetUniCode($(a.toLowerCase()).text());
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
"pstring-asc": function (a, b) {
|
|
|
|
|