Sorting language with intl.js
Sorting language with intl.js
Hello,
i looking for change local for sorting in tables. I found that best idea is intl.js. But its not working for me. Inspect show this error:
TypeError: Cannot read property 'ext' of undefined
at intl.js:72
$.fn.dataTable.ext.order.intl = function ( locales, options ) {
at intl.js:66
factory( jQuery, window, document );
at intl.js:69
(function( $, window, document ) {
I dont know what going on because its javascript from original page. Here is my code definition for order and table:
$.fn.dataTable.ext.order.intl('fr');
var table = $('#myTable').DataTable({
columnDefs: [
{ orderable: true, targets: 0 },
{ orderable: true, targets: 1 },
{ orderable: true, targets: 2 },
{ orderable: false, targets: 3 },
{ orderable: false, targets: 4 }
],
oLanguage: {
oAria: {
"sSortAscending": "Usporiadať vzostupne",
"sSortDescending": "Usporiadať zostupne"
},
oPaginate: {
"sFirst": "Prvá strana",
"sLast": "Posledná strana",
"sNext": ">",
"sPrevious": "<"
},
sEmptyTable: "Žiadne zaznamenané kontakty",
sInfo: "Zobrazené od _START_ po _END_ z celkového počtu _TOTAL_",
sInfoEmpty: "Žiadne zaznamenané kontakty",
sInfoFiltered: "(vyfiltrované z _MAX_ všetkých kontaktov)",
sLengthMenu: "Zobraziť _MENU_ kontaktov na stranu",
sLoadingRecords: "Prosím počkajte - načítavam...",
sProcessing: "Spracúvam údaje",
sSearch: "Vyhľadať:",
sZeroRecords: "Žiadne zaznamenané kontakty",
},
dom: "<'row'<'col-sm-4'l><'col-sm-4 toolbar'><'col-sm-4'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "Všetky"]
],
"paging": false,
"ordering": true,
"info": true,
"stateSave": false,
"searching": true
});
Thank you for any advice.
This question has an accepted answers - jump to answer
Answers
Hi @irelevant ,
The only
ext
on that code comes from$.fn.dataTable.ext.order.intl
. Have you included the jQuery and DataTable sources before you make that call?Cheers,
Colin
Hi @colin thank you for your response. Here is my script include:
JS Global Compulsory
<script src="~/assets/vendor/jquery/jquery.js"></script>
<script src="~/assets/vendor/jquery-migrate/jquery-migrate.min.js"></script>
<script src="~/assets/vendor/jquery.easing/js/jquery.easing.js"></script>
<script src="~/assets/vendor/popper.min.js"></script>
<script src="~/assets/vendor/bootstrap/bootstrap.js"></script>
dataTables
<script src="~/js/intl.js"></script>
<script src="~/js/datatables.js"></script>
And one more error showing in inspect but i thought is not important and its just because of error of intl.js or something else but maybe its more important than i think:
Swap your
datatables.js
andintl.js
files around.intl.js
contains a plug-in for DataTables.Allan
@allan its working. Thank you.