javascript - How to change the pagination number format of datatables to another locale? -
how change pagination number format of databales locale format, i.e. arabic number format. have read datatables manual(https://www.datatables.net/examples/basic_init/language.html) , mdn(https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/numberformat) failed find solution.
you have 2 choices (as far can tell) :
alter code, internal function
pagebutton
addeddatatable.ext.renderer
line 14205 (v 1.10.7)$.extend( true, datatable.ext.renderer, { pagebutton: {
change code line 14258 from
default: btndisplay = button + 1; btnclass = page === button ? classes.spagebuttonactive : ''; break;
to
default: btndisplay = new intl.numberformat('ar-eg').format(button + 1); btnclass = page === button ? classes.spagebuttonactive : ''; break;
replace rendered content upon
draw.dt
event$('#example').on('draw.dt', function() { $('.paginate_button').not('.previous, .next').each(function(i, a) { var val = $(a).text(); val = new intl.numberformat('ar-eg').format(val); $(a).text(val); }) });
guess pagination should this
demo -> http://jsfiddle.net/hojpyahy/
Comments
Post a Comment