问题描述
我在同一页面中使用2个数据表。当我从搜索框搜索时,两个表受到影响。我该如何解决这个问题。页面加载时,我得到了我的2个数据表。 GET时没有错误。但是,当我尝试在其中之一中搜索某些值时,两个表会同时受到影响。 例如,当我尝试在table1搜索框中进行搜索时:例如:“ XYZ”,它正在在table2搜索框中进行写入:“ XYZ”
我该如何解决?
这是我的用途:
<table id="exampleDatatable" class="table">
<thead>
<tr>
....
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
....
</tr>
}
</tbody>
</table>
这是我的Javascript:
$.ajax({
"url": "xxxxxxxx" + @Model.ID,"method": "GET",success: function (data) {
$("#YYYYYYYYY").html(data);
DataTableTRInitialize(
$("#bayiPersonelsDT"),[
{ "targets": 1,"type": "locale-compare" }
]
);
},error: function () { }
});
最后是我的DataTableTRInitialize()
table = $(table).DataTable({
"idisplayLength": 10,"order": [[0,"desc"]],"columnDefs": defs,"oLanguage": {
"sUrl": '/Content/js/demo/Turkish.json'
},stateSave: true
});
NEW Edit 9/14/2020:
我在dataTables.bootstrap4.js中找到了它:
/* Default class modification */
$.extend( DataTable.ext.classes,{
sWrapper: "dataTables_wrapper dt-bootstrap4",sFilterInput: "form-control form-control-sm",sLengthSelect: "custom-select custom-select-sm form-control form-control-sm",sProcessing: "dataTables_processing card",sPageButton: "paginate_button page-item"
} );
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)