- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个dataTable
,其搜索仅在表
的第一行
上进行。
Question: why search is not working on every row, It is acting for first row only?why
为了更清楚地了解,请参阅此jsFiddle:https://jsfiddle.net/pkxmnh2a/30/
片段:
$(document).ready(function () {
var table = $('#examples').DataTable();
$('a.toggle-vis').on('click', function (e) {
e.preventDefault();
var column = table.column($(this).attr('data-column'));
column.visible(!column.visible());
});
$('#examples tfoot th').each(function () {
var title = $('#examples thead th').eq($(this).index()).text();
$(this).html('<input tyepe="text" placeholder="Search ' + title + '"/>');
});
table.columns().eq(0).each(function (colIdx) {
$('input', table.column(colIdx).footer()).on('keyup change', function () {
table.column(colIdx)
.search(this.value)
.draw();
});
});
});
.widthind{
width: 30px;
height: 30px;
background-color: black;
color: white;
}
form {
margin: 0;
padding: 0;
display: -webkit-inline-box;
}
<link href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table table-boardered" id="examples">
<thead class="thead-dark">
<tr>
<th>Id</th>
<th>Customer Name</th>
<th>Description</th>
<th>Order Number</th>
<th>PO Number</th>
<th>Quantity</th>
<th>Due Date</th>
<th>Billing Address</th>
<th>Shipping Address</th>
<th>Installing Address</th>
<th>Design</th>
<th>Production</th>
<th>Shipping</th>
<th>Install</th>
<th>Production Manager</th>
<th>Project manager</th>
<th>Sales Representatives</th>
<th>Shipping Method</th>
<th>Created At</th>
<th>Status</th>
<td style="display:none;"></td>
</tr>
</thead>
<tbody>
<tr id="deletetr21">
<td class="notIdClass">2PslfYy</td>
<td class="editableDataClass" data-edit="21" data-table="customer_name">dsndfbbd ejaz</td>
<td class="editableDataClass" data-edit="21" data-table="description"></td>
<td class="editableDataClass" data-edit="21" data-table="order_number">2061</td>
<td class="editableDataClass" data-edit="21" data-table="po_number"></td>
<td class="editableDataClass" data-edit="21" data-table="quantity"></td>
<td class="editableDataClass" data-edit="21" data-table="due_date"></td>
<td class="editableDataClass" data-edit="21" data-table="billing_address"></td>
<td class="editableDataClass" data-edit="21" data-table="shipping_address"></td>
<td class="editableDataClass" data-edit="21" data-table="installing_address"></td>
<td class="editableDataClass" data-edit="21" data-table="design"></td>
<td class="editableDataClass" data-edit="21" data-table="production"></td>
<td class="editableDataClass" data-edit="21" data-table="shipping"></td>
<td class="editableDataClass" data-edit="21" data-table="install"></td>
<td class="editableDataClass" data-edit="21" data-table="production_manager"></td>
<td class="editableDataClass" data-edit="21" data-table="project_manager"></td>
<td class="editableDataClass" data-edit="21" data-table="sales_representative"></td>
<td class="editableDataClass" data-edit="21" data-table="shipping_method"></td>
<td data-table="workflow" style="color:#0277bd">16-01-2018</td>
<td class="statusNotClass">
<select data-edit="21" data-table="status" class="defineWorkflow">
<option value="">-- Select --</option>
<option value="progress">Progress</option>
<option value="pending">Pending</option>
<option value="completed">Completed</option>
</select>
</td>
<td>
</td></tr></tbody><thead id="alsoDeleteThead21" class="thead-dark excludeAction" style="background-color: !important;">
<tr><th style="width: 100% !important"> Edit Option</th>
<th colspan="50 ">
<a> <form action="http://localhost:8000/send_customer_status" method="POST">
<input type="hidden" name="_token" value="DbhEfiBiILxfL7GeRivtIsVw2U1VAyxcWAqw3WaN">
<input type="hidden" name="job_id" value="21">
<input type="hidden" name="customer_id" value="9">
<button class="btn btn-danger send-status " title="Status Sent On - ">Send Status </button>
</form></a>
<a href="#" class="btn btn-danger send-quotation">Send Quotation</a>
<a href="#" class="btn btn-danger send-invoice">Send in Voice</a>
<a href="#" class="btn btn-danger delete-customer" data-delete="21">Delete</a></th>
</tr></thead>
<tbody><tr id="deletetr22">
<td class="notIdClass">AnsAhKR</td>
<td class="editableDataClass" data-edit="22" data-table="customer_name">Raj Laxmi</td>
<td class="editableDataClass" data-edit="22" data-table="description">45x56 led board</td>
<td class="editableDataClass" data-edit="22" data-table="order_number">2164</td>
<td class="editableDataClass" data-edit="22" data-table="po_number">45231</td>
<td class="editableDataClass" data-edit="22" data-table="quantity"></td>
<td class="editableDataClass" data-edit="22" data-table="due_date">2018/01/15 16:23</td>
<td class="editableDataClass" data-edit="22" data-table="billing_address"></td>
<td class="editableDataClass" data-edit="22" data-table="shipping_address"></td>
<td class="editableDataClass" data-edit="22" data-table="installing_address"></td>
<td class="editableDataClass" data-edit="22" data-table="design">45x56 led board, 18x90 flex, 500 brouchers</td>
<td class="editableDataClass" data-edit="22" data-table="production">back and front board 2 side</td>
<td class="editableDataClass" data-edit="22" data-table="shipping">Call before installing</td>
<td class="editableDataClass" data-edit="22" data-table="install">he needs to get installed on 17th - Jan-2018</td>
<td class="editableDataClass" data-edit="22" data-table="production_manager">Saif</td>
<td class="editableDataClass" data-edit="22" data-table="project_manager">Hemanth</td>
<td class="editableDataClass" data-edit="22" data-table="sales_representative"></td>
<td class="editableDataClass" data-edit="22" data-table="shipping_method">mini truck</td>
<td data-table="workflow" style="color:#0277bd">16-01-2018</td>
<td class="statusNotClass">
<select data-edit="22" data-table="status" class="defineWorkflow">
<option value="">-- Select --</option>
<option value="progress">Progress</option>
<option value="pending">Pending</option>
<option value="completed">Completed</option>
</select>
</td>
<td>
</td></tr></tbody><thead id="alsoDeleteThead22" class="thead-dark excludeAction" style="background-color: !important;">
<tr><th style="width: 100% !important"> Edit Option</th>
<th colspan="50 ">
<a> <form action="http://localhost:8000/send_customer_status" method="POST">
<input type="hidden" name="_token" value="DbhEfiBiILxfL7GeRivtIsVw2U1VAyxcWAqw3WaN">
<input type="hidden" name="job_id" value="22">
<input type="hidden" name="customer_id" value="12">
<button class="btn btn-danger send-status statusAlreadySent" title="Status Sent On - 2018-01-16 17:28:00">Send Status </button>
</form></a>
<a href="#" class="btn btn-danger send-quotation">Send Quotation</a>
<a href="#" class="btn btn-danger send-invoice">Send in Voice</a>
<a href="#" class="btn btn-danger delete-customer" data-delete="22">Delete</a></th>
</tr></thead>
<tfoot>
<tr>
<th>Id</th>
<th>Customer Name</th>
<th>Description</th>
<th>Order Number</th>
<th>PO Number</th>
<th>Quantity</th>
<th>Due Date</th>
<th>Billing Address</th>
<th>Shipping Address</th>
<th>Installing Address</th>
<th>Design</th>
<th>Production</th>
<th>Shipping</th>
<th>Install</th>
<th>Production Manager</th>
<th>Project manager</th>
<th>Sales Representatives</th>
<th>Shipping Method</th>
<th>Created At</th>
<th>Status</th>
<td style="display:none;"></td>
</tr>
</tfoot>
</table>
请帮助我提前致谢!!
最佳答案
我想说你应该使用rowspan
和colspan
在这里演示您的表格(因此使用两个 <tr>
进行在线)这将有助于您不使用多个 <tbody>
在您的表格中(事实上,您不得在表格内使用多个一个<tbody></tbody>
),或者一个正确的表格应如下所示:
<table>
<thead>
<tr>
<th>Header column A<th>
<th>Header column B<th>
</tr>
</thead>
<tbody>
<tr>
<td>Content column A Row 1<td>
<td>Content column B Row 1<td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
关于javascript - 为什么 dataTable 搜索仅适用于表的第一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48276157/
该插件的绝大多数文档表明您可以使用 对其进行初始化 $('#example').dataTable(); 但是http://www.datatables.net/examples/api/multi_
我有一个 SQL 查询,它获取一些数据(dbtable 表中的语言列)。查询使用 GROUP_CONCAT,因此一个单元格有多个结果,例如 "Ajax, jQuery, HTML, CSS". 我想要
我有一个由 jQuery DataTables 增强的动态表,它显示一个与此类似的自定义对象 example . JSON: { "data": [ { "name": "Ti
我有两个数据表。首先是 DataTable NameAddressPhones = new DataTable(); 具有三列姓名、地址和电话号码。但我只想要两列姓名和地址数据,所以我想将这些列(包含
有没有办法将“处理...”语言放在 DataTable 对象的顶部而不是垂直中间?如果我有一张长 table ,它会隐藏在页面之外,因为它的默认位置在中间。 $('#example').dataTab
当我们向 DataTables 添加自定义过滤器时: $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { ..
我可以更改 dataTables 中搜索文本字段的宽度吗? 我现在正在编写以下代码,但它不起作用。 $('#example').dataTable() .columnFilter(
使用 DataTables plugin 时 如何使分页和 Showing 1 to 8 of 8 entries 出现在顶部而不是底部? 谢谢 最佳答案 每个数据表控件都以唯一的 id 命名计划之后
Angular 版本:6.0.4 ~ 节点版本:10.4.1 ~ NPM 版本:6.1.0 我看到这个问题被问了很多次,但没有回答。 关注这些后instructions to install angu
当单击外部按钮时,我正在尝试使用 DataTable(新版本)修改单元格值。我现在有以下内容: $(document).on('click', '.dropdown-menu li a', funct
引用:http://datatables.net/reference/api/page.info() 我正在尝试获取 ajax POST 生成的 jQuery DataTable 的当前分页信息。 使
以下对我有用: $('#datatable').on('page.dt', function() { alert("changed"); }); 每当我更改页面时,都会显示警报。但是如果我想警
我有一个 HTML 表,我在其中应用了 DataTables 函数。我使用表的第一行并将"template"类应用为我的模板行。然后选择此格式并使用 JSON feed 填充表中的所有行。问题是 Da
我有一个由 DataTables 1.10 驱动的表。过滤已打开。当我在下面谈论“做搜索”时,我指的是使用该表的过滤功能。 问题描述 关闭 stateSave 一切正常。但是,当 stateSave
看看这个例子,http://www.datatables.net/examples/api/multi_filter_select.html ,它使用 DataTable API 中的 columns
我正在使用 jQuery DataTables 在 spring 4.x 应用程序中创建一个报表页面来呈现报表。 通过 Jackson 消息转换器解析后,服务器返回以下对象。 { "data"
我在刷新 Primesfaces 的延迟加载数据表时遇到了一些问题。我正在使用 3.0.M4。 使用过滤器在您的示例中使用三个类。还尝试了仅使用延迟加载的示例,但随后未在 Controller 中重新
在 Blue Prism (BP) 中,有一种叫做 Collection 的东西,它基本上是 C# 中的 DataTable。在 BP 中,您可以在集合中拥有集合。我的问题是,您可以在 C# 的 Da
我正在使用 Flutter DataTables 来显示购物车中的商品列表。现在我想编辑任何选定行的数量。有没有办法获取用户点击的行信息? 以下是我的DataTable的完整代码: class _Da
我有一个关于 primefaces 数据表组件的问题。我想将 DataTable 变量绑定(bind)到 p:dataTable,以便我能够从支持 bean 以编程方式操作第一个、行、rowsPerP
我是一名优秀的程序员,十分优秀!