jquery datatable显示隐藏子表
2021-07-07 21:04
标签:query sort cli word als values poi size exp js: $(function () {
jquery datatable显示隐藏子表 标签:query sort cli word als values poi size exp 原文地址:http://www.cnblogs.com/h2zZhou/p/7099360.html
Values
Number
Other
value 1
111
xyz
value 2
222
xyz
value 3
333
xyz
var parentTable = $("#parentTable").DataTable({
order: [1, "asc"],
columnDefs: [{
sortable: false,
targets: [0]
}]
});
$(".expander").css({
cursor : "pointer"
}).click(function () {
var row = parentTable.row($(this).closest("tr"));
if(row.child() == undefined){
$(this).html("-");
var $table =
$("
");
InnerV1
InnerV2
InnerV3
InnerV4
foo
bar
biz
baz
baz
biz
bar
foo
bar
foo
baz
biz
$table.attr("id", "childTable_" + row.index());
var childTable = $table.DataTable({
order: [0, "desc"],
columnDefs: [{
sortable: false,
targets: [1, 2]
}]
});
row.child(childTable.table().Container());
row.child.show();
} else {
$(this).html("+");
row.child(false);
}
});
});
文章标题:jquery datatable显示隐藏子表
文章链接:http://soscw.com/index.php/essay/102205.html