Accent neutralise plugin does not work when "data-order" tag is used

Accent neutralise plugin does not work when "data-order" tag is used

toxpaltoxpal Posts: 10Questions: 1Answers: 0
edited October 2022 in Free community support

As the title says: the plugin does not work when "data-order" HTML5 tag is used. Type "Zurich" in filter fields in both demos below:

Working example: https://jsfiddle.net/a7c2Lh06/
Not working example ("data-order" HTML5 tag is used): https://jsfiddle.net/a7c2Lh06/1/

I was able to fix it by adding another attribute ("data-filter"), but I believe plugin should work without adding it.

Replies

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    You are using numbers for the data-order, for example <td data-order="1">New York</td>. I believe the problem is that Datatables type detection will set the column type to num for ordering by number. See the columns.type for more details.

    The plugin is replacing the search functions for type string and type html, for example:

    searchType.string = function ( data ) {
        return ! data ?
            '' :
            typeof data === 'string' ?
                removeAccents( data ) :
                data;
    };
    

    There isn't a searchType for num. Since the column type is num the plugin isn't used. However if you use a string for the data-order the plugin will be used. I updated your example to show this by adding a console log statement to the above function and to use lettres for the first column.
    https://jsfiddle.net/7q3b0m4o/1/

    Sounds like you either need to use data-filter like you said. Or you could use columns.render for the filter operation to remove the accents using the removeAccents() function from the plugin. See Orthogonal data for details.

    Kevin

  • toxpaltoxpal Posts: 10Questions: 1Answers: 0

    Thank you for the explanation. I will stick with data-filter then.

Sign In or Register to comment.