How To Change The Pagination Number Format Of Datatables To Another Locale?
How do I change the pagination number format of databales to another locale format, i.e. Arabic number format. I have read the datatables manual(https://www.datatables.net/examples
Solution 1:
You have two choices (as far as I can tell) :
Alter the code, specifically the internal function
pageButton
added toDataTable.ext.renderer
about line 14205 (v 1.10.7)$.extend( true, DataTable.ext.renderer, { pageButton: {
change the code about 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 the rendered content upon the
draw.dt
event$('#example').on('draw.dt', function() { $('.paginate_button').not('.previous, .next').each(function(i, a) { var val = $(a).text(); val = newIntl.NumberFormat('ar-EG').format(val); $(a).text(val); }) });
Guess the pagination should look something like this
demo -> http://jsfiddle.net/hojpyahy/
Solution 2:
They have internationalisation plug-ins for changing locale format.
See this example using ajax , they changed language to german in this example : https://datatables.net/plug-ins/i18n/]1
Similarly, you can do for arabic.
Post a Comment for "How To Change The Pagination Number Format Of Datatables To Another Locale?"