如何使用代码点火器使用Bootstarp数据表搜索数据嵌套表数据

How to search data nested table data using Bootstarp datatables using Codeigniter?

本文关键字:数据 搜索 数据表 嵌套 Bootstarp 何使用 代码 点火器      更新时间:2023-09-26

我有一个使用引导数据表创建的表,当我搜索数据时,它在表中工作。

但我在每一行上都创建了一个嵌套表。当我单击特定行上的"显示客户"链接时,将显示此嵌套表。

现在,当我从父表中搜索元素时,它只搜索父表元素,我想搜索子表元素以及.

如何做到这一点。

Html表代码:

    <table class="table table-hover" id="table2">
            <thead>
              <tr>
                <th>ID</th>
    <th>Action</th>
              </tr>
            </thead>
            <tbody>
      <tr>
                <td>1</td>
    <a href="#" onClick="project_list('<?=$item->bldr_ID;?>',0)">
                    details
                  </a>
                </td>
              </tr>

//Here generate another child table when I click details link (will call "project_list" function using ajax)
// Now want to search element both parent and child elements from parent table search column
    </tbody>
          </table>

Datatables只能搜索表中的本地内容。你有两个选择:

  1. 您可以在创建过程中将«project_list»数据写入表中并将其隐藏。

  2. 您进行服务器端搜索https://datatables.net/manual/server-side.