gpt4 book ai didi

javascript - 一页中具有不同参数的多个数据表

转载 作者:行者123 更新时间:2023-12-03 00:27:10 25 4
gpt4 key购买 nike

我在同一页面上有两个数据表,如下例所示: https://datatables.net/examples/basic_init/multiple_tables.html

直到没有问题..

它共享许多共同参数,例如按钮或语言

$('table').DataTable({
language: {
search: "",
searchPlaceholder: "Search ...",
sLengthMenu:"_MENU_",
sInfo:"_TOTAL_ elmt",
infoFiltered: "",
sInfoEmpty: "0 elmt",
"oPaginate": {
"sPrevious": "<",
"sNext": ">"
}
}
});

但是,我希望给他们不同的 pageLength 大小和不同的尝试,我该怎么办?

已知第一个表的 IDtable-one第二个表的 IDtable-two

最佳答案

这样做:

// create an object with your settings for the first table
var dataTableOptions = {
language: {
search: "",
searchPlaceholder: "Search ...",
sLengthMenu:"_MENU_",
sInfo:"_TOTAL_ elmt",
infoFiltered: "",
sInfoEmpty: "0 elmt",
"oPaginate": {
"sPrevious": "<",
"sNext": ">"
}
}
};

// initialize that table
$('#table1').DataTable(dataTableOptions);

// modify whatever settings you need to in the object you created
dataTableOptions.language.sLengthMenu = "some new value";

// use the modified object to initialize the second table
$('#table2').DataTable(dataTableOptions);

关于javascript - 一页中具有不同参数的多个数据表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54037641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com