如何显示作品“搜索"在datatable jquery和bootstrap中的搜索字段之前
我正在使用引导程序数据表功能在屏幕上显示表.由于某些原因,搜索字段之前未显示单词SEARCH.我不知道我哪里错了.经过研究,我找到了一种通过在JavaScript中的table属性中添加以下行 oLanguage:{" sSearch:" Search} 来添加单词的方法.
I am using bootstrap datatable feature to display the table in the screen. For some reason, the word SEARCH is not shown before the search field. I do not know where I am wrong. After research, I found a way to add the word by adding the following line oLanguage":{"sSearch": "Search"} to the table property in javascript.
此修复程序仅对一个表起作用,而对另一表不起作用. 问题是:
The fix worked for one table, but not for the other. Question is:
- 默认显示单词的方式是什么?
- 为什么它不能用于其他表?
代码段:
$('#myTable').dataTable( {
"bProcessing": true,
"bAutoWidth": true,
"sAjaxSource": "../data/myStruts.action",
"sAjaxDataProp": "",
"bPaginate": true,
"bInfo":false,
"aoColumns": [
{"mData":"userID"},
{"mData":"currentQueue"},
{"mData":"transactionDate"},
{"mData":"postingDate"}
],
"oLanguage":{"sSearch": "Search"}
});
感谢大家回答我的问题...
Thanks everyone for answering my questions...
我对数据表进行了更多研究,发现引导数据表提供的默认值已被修改.数据表的 oLanguage 属性可以自定义单词.最初, sSearch 的值是平淡的,我将其更改为 Search .现在,无论我在哪里使用数据表,都将出现search关键字,而无需在相应的JS中添加任何额外的行. 以下是 bs3.datatables.js
I did some more research on datatable and found out that the default values provided by bootstrap-datatables were modified.The oLanguage attribute of datatable has the ability to customize your word. Initially, the value for sSearch was bland and I change it to Search. Now, wherever I use the datatable, the search keyword appears without adding any extra line in the respective JS. Below is an extra of bs3.datatables.js
(function ($) {
/* Set the defaults for DataTables initialisation */
$.extend( true, $.fn.dataTable.defaults, {
"sDom": "<'row'<'col-sm-12'<'pull-right'f><'pull-left'l>r<'clearfix'>>>t<'row'<'col-sm-12'<'pull-left'i><'pull-right'p><'clearfix'>>>",
"sPaginationType": "bs_normal",
"oLanguage": {
"sLengthMenu": "Show _MENU_ Rows",
"sSearch": "Search"
}
} );