简体   繁体   English

Jquery Datatables:在过滤器输入字段上设置类

[英]Jquery Datatables:set the class on the filter input field

How can I set the class on the 'search' field on the datatables plugin please. 如何在datatables插件的'search'字段中设置类。 I'm using the Jquery UI theme as well. 我也在使用Jquery UI主题。

        $('#idSmovData').dataTable( {
             "sScrollY": "600px"
            ,"bPaginate": false
            ,"bFilter": true
            ,"bJQueryUI": true
            ,"bInfo": false
            ,"bSort": false
        });

You can set the search filter wrapper div style class using oStdClasses 您可以使用oStdClasses设置搜索过滤器包装器div样式类

$.fn.dataTableExt.oStdClasses["sFilter"] = "my-style-class";

And than use regular css to target the search input field: 而且使用常规css来定位搜索输入字段:

.my-style-class input[type=text] {
     color: green;
}

Please refer to the datatables styling section for more details. 有关详细信息,请参阅数据表样式部分。

$('div.dataTables_filter input').addClass('form-control');
$('div.dataTables_length select').addClass('form-control');

Here I am adding the Bootstrap class form-control to the filter input and the length select, as an example. 这里我将Bootstrap类form-control到过滤器输入和长度选择中,作为示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM