Difficulty getting plug-ins diacritics-sort and natural to work
Difficulty getting plug-ins diacritics-sort and natural to work
I must confess to still be using version 1.10.21, which works fine for me, and need time before implementing version 2. I have difficulty getting plug-in diacritics-neutralise to work. I have reduced the table in the test case to 14 entries and modified the first column to test sorting; one thus needs to set the table to display more than 10 entries per page. Note the following:
- Ökonomie should come before Oracle;
- schön before Schubert;
- À propos at the top, followed by (in this order) été, Été, Été, étêter, ethnie;
- Été is used twice, and été once, but the lowercase version is sorted between the two capitalized ones.
The correct order should thus be: À propos, été, Été, Été, étêter, ethnie, étirer, étoffe, Ökonomie, Oracle, Schomberg, Schön, Schubert, sève. Why is it not achieved?
Furthermore, with regard to the natural plug-in, is it correct to use both “nohtml” and “ci” on two separate lines, or should the two commands be merged and how?
{ type: 'natural-nohtml', targets: '_all'},
{ type: 'natural-ci', targets: '_all'}
Are the following lines equivalent, or is one preferable:
{ targets: 0; type: 'diacritics-neutralise'}
{ type: 'diacritics-neutralise'; targets: '_all' }
This question has an accepted answers - jump to answer
Answers
The
natrual-nohtml
type produces the sorting you want: https://live.datatables.net/zefehawa/2/edit .The natural sorting for 2.x has been massively simplified and now uses
localeCompare
. The source is interesting (if you like that sort of thing).A column can have only one type, so one would overwrite the other there. The
-ci
is case-insensitive, which it doesn't sound like what you want. There isn't anatrual-ci-nohtml
type - maybe I should add that...Allan
Thank you for your reply, which shows correct sorting. I see that the only difference is that you have commented out line
var table = new DataTable('#example');
in the JavaScript column. The problem is that I have no such line in my code, which I am reproducing below. My knowledge of JavaScript is not advanced enough to really know how to circumvent the problem.Of course, the test case uses version 2.0.5, and my code 1.10.21; could it be the culprit? I have tried replacing the version numbers at the top following the
cdn.datatables.net
bits in the <head> section of the test case, but to no avail; the old versions no longer seem to be on your server.In the <head> section (template)
In the <body> section, just before the tables (each of which is identified with table1 table2, etc.)
I did that because you have the initialisation in the "HTML" tab:
My change for the original was to comment in the
natrual-nohtml
type and comment out any others that were enabled.Like in your code snippet should be all that is needed. If that isn't working for you, could you give me a link to a test case showing that issue (you can PM me the link if you don't want you make your page public).
Allan