[英]How to return a div using jQuery in a DataTable child row
I have a problem when returning a div using jQuery.使用 jQuery 返回 div 时遇到问题。 The attached code below works only until the first display of childRow content, unfortunately not later.
下面的附加代码仅在第一次显示 childRow 内容之前有效,不幸的是不能稍后。 This is probably due to returning an item with the same ID, does anyone have an idea how else to return this div?
这可能是由于返回了具有相同 ID 的项目,有人知道如何返回这个 div 吗?
Script脚本
function format () {
return $('#myDiv');
}
(document).ready(function() {
var table = $('#myTable').DataTable( {
// table settings
} );
$('#myTable tbody').on('click', 'td', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
row.child.hide();
}
else {
row.child( format() ).show();
}
} );
} );
myDiv我的Div
div(id="myDiv" class="container"){
//some images
//some java bean references
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.