简体   繁体   English

jQuery DataTable:TD内部表,子表,嵌套表

[英]Jquery DataTable : Table Inside TD, Sub Table, Nested Table

I am using datatable where I need to show a table inside td cell, I have checked drill down example but that requires click on the plus sign, apart that is viewed below the row that contains plus sign. 我正在使用数据表,需要在td单元内显示一个表,已经检查了向下钻取示例,但需要单击加号,但要在包含加号的行下方查看。 That is not required 那不是必须的

I want to create exact nested table like 我想创建精确的嵌套表,如 在此处输入图片说明

where td cell have one nested table inline and no need to click on any plus sign. 其中,td单元有一个嵌套表内联,无需单击任何加号。 Using datatable is this possible? 使用数据表这可能吗? Any reference please? 有什么参考吗?

Datatable offers basic support for complex headers : Datatable为复杂的标头提供了基本支持:

http://datatables.net/release-datatables/examples/basic_init/complex_header.html http://datatables.net/release-datatables/examples/basic_init/complex_header.html

Otherwise, you can use callbacks to have your table render something more complicated than single adjacent cells. 否则,您可以使用回调使表呈现比单个相邻单元格更复杂的内容。

http://datatables.net/usage/callbacks http://datatables.net/usage/callbacks

Look for fnDrawCallback and fnRowCallback 寻找fnDrawCallbackfnRowCallback

The following example will not achieve what you want, but will give you an example of how you can manipulate the html each time datatables modifies it (using fnDrawCallback ) : 下面的例子将不能达到你想要什么,但会给你的,你可以如何操作的HTML每次一个例子datatables修改它(使用fnDrawCallback ):

http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html

Here is a basic example for using fnRowCallback : 这是使用fnRowCallback的基本示例:

http://datatables.net/release-datatables/examples/advanced_init/row_callback.html http://datatables.net/release-datatables/examples/advanced_init/row_callback.html

A piece of warning though : if you start fiddling with the table structure, you may end up with surprises with the "filter" and "sort" functionalities. 但是,一个警告是:如果您开始摆弄表结构,则可能会因“过滤器”和“排序”功能而感到惊讶。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM