"intl" sorting plugin doesn't work (an issue about columnDefs type:string?)
"intl" sorting plugin doesn't work (an issue about columnDefs type:string?)

I'm trying to make a table with Bootstrap 4.3.1, DataTables and "intl" sorting plugin. Codes are like this:
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.18/datatables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/intl.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.fn.dataTable.ext.order.intl();
$('#data-tables').DataTable( {
"columnDefs": [ { "type": "string", "targets": 2 } ],
"order": [[2, "asc"]],
});
} );
</script>
But this doesn't work at all. When I try to sort the table by column 2, it's sorted by column 0.
Then I found that even I removed the lines about "intl" plugin the same issue was there. It seems
"columnDefs": [ { "type": "string", "targets": 2 } ],
is the cause.
But I need this columnDefs to make "intl" plugin work, I guess? What should I do?
This discussion has been closed.
Answers
If I remove columnDefs, "intl" do nothing. My browser is Chrome 73.
Hi @koonkoons ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Hi colin,
I found the cause - my cells contain HTML tags including ID numbers (like
<a href="http://bra.bra/1">
), so"type": "string"
messes them up.However, it seems "intl" plugin doesn't work with
html
type columns.http://live.datatables.net/qihopuna/1/edit
Column 1's type is
string
, so "intl" plugin works. (AAA, ØØØ, ZZZ).Column 2's type is
html
, so "intl" plugin doesn't work. (AAA, ZZZ, ØØØ).Is there a way to make "intl" work with
html
columns?Thanks.
Try this:
Allan
Hi @allan,
I replaced
intl.js
tobut it didn't work.
Need to also execute the
html-intl
function. I've made a few small changes (including an easier name) here:http://live.datatables.net/qihopuna/4/edit
Allan
Hi @allan,
Thanks, it finally worked!
The final state of
intl.js
isand the execution is
Thank you so much.