Sort Chinese characters Sorting in Javascript for Chinese Character. The Chinese Characters are sorted on the radical and number of strokes. This plug-in performs sorting for Chinese characters using the Javascript localeCompare function. Please note that localeCompare is not implemented in the same way in all browsers, potentially leading to different results (particularly in IE). Plug-in code1 2 3 4 5 6 7 8 9 | jQuery.extend( jQuery.fn.dataTableExt.oSort, {<font></font>
"chinese-string-asc" : function (s1, s2) {<font></font>
return s1.localeCompare(s2);<font></font>
},<font></font>
<font></font>
"chinese-string-desc" : function (s1, s2) {<font></font>
return s2.localeCompare(s1);<font></font>
}<font></font>
} );<font></font>
|
CDNThis plug-in is available on the DataTables CDN: Note that if you are using multiple plug-ins, it is beneficial in terms of performance to combine the plug-ins into a single file and host it on your own server, rather than making multiple requests to the DataTables CDN. Version controlIf you have any ideas for how this plug-in can be improved, or spot anything that is in error, it is available on GitHub and pull requests are very welcome! Example1 2 3 4 5 | $( '#example' ).dataTable( {<font></font>
columnDefs: [<font></font>
{ type: 'chinese-string' , targets: 0 }<font></font>
]<font></font>
} );<font></font>
|
|