开发者

Jquery plugin DataTables, custom filtering

How can I set a custom filter in my code to ignore accents and special char开发者_StackOverflow社区acter from the table before filtering?

I am using DataTables plugin (http://www.datatables.net/)


Include a version of the data that is missing the accents as a column in the datatable. You hide that column by adding an entry in the aoColumns array in the configuration literal.

Let's say you start with 4 columns. One of these has accents. Add a fifth column with non-accented data, and add a configuration literal with { "bVisible": false } so that it will not be displayed.

It's invisible, but it's still searchable / filterable:

$(document).ready(function() {
    $('#example').dataTable( {
        "aoColumns": [ 
            null,
            null,
            null,
            null,
            { "bVisible": false }
        ] } );
});

See the column documentation for more on configuration. DataTables with hidden columns is an example in use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜