該頁面顯示的是腳名,但沒有輸入列過濾器值的位置。 我查看了數據表網站上的例子以及堆棧溢出網站上的其他例子,發現沒有線索如何解決這個問題。 任何幫助或建議如何解決此問題將不勝感激。 謝謝。dataTables columnFilter無法爲列過濾輸入數據
<% provide(:title, 'TBMs Daily Progress') %>
<% if signed_in? %>
<h3>TBMs Max Station by day - Today's date: <%[email protected]_date%></h3>
<% if @current_date != @tbms_progress_W.daily_date %>
<h6 class="error-message">
<%= "Today's location for TBM W is not loaded" %>
<%= " Last TBM W recorded date was: " %>
<%[email protected]_progress_W.daily_date %>
</h6>
<% end %>
<% if @current_date != @tbms_progress_E.daily_date %>
<h6 class="error-message">
<%= "Today's location for TBM E is not loaded" %>
<%= " Last TBM E recorded date was: " %>
<%[email protected]_progress_E.daily_date %>
</h6>
<% end %>
<p>
<% if current_user.admin? %>
<%= link_to "Add new location", new_tbms_progress_path, class: "btn btn-sm btn-danger" %>
<% end %>
<%= link_to "List view", tbms_progresses_path, class: "btn btn-sm btn-primary" %>
</p>
<table id="progresstable" class="display table-bordered table-condensed table-responsive table-hover">
<thead style="background-color: #bbbbbb;">
<tr>
<th>Daily Date</th>
<th>TBM ID</th>
<th>Max Station</th>
<th>TBM Status</th>
<th>ID</th>
</tr>
</thead>
<tbody>
<% @tbms_progresses.each do |tbms_progress| %>
<tr>
<td><%= tbms_progress.daily_date %></td>
<td><%= tbms_progress.tbm_id %></td>
<td><%= number_with_precision tbms_progress.max_station, precision: 2 %>
<td><%= tbms_progress.tbm_status %></td>
<td><%= link_to tbms_progress.id, tbms_progress %></td>
</tr>
<% end %>
</tbody>
<tfoot>
<tr>
<th>Daily Date</th>
<th>TBM ID</th>
<th>Max Station</th>
<th>TBM Status</th>
<th>ID</th>
</tr>
</tfoot>
</table>
<hr/>
<h6>Legend: W aka TBM1 or 26900, E aka TBM2 or 27000</h6>
<% else %>
<%= render 'instruments/unsigned' %>
<% end %>
<script>
$(document).ready
(function()
{
$('#progresstable').dataTable
(
{
/*sPaginationType: "full_numbers",*/
bJQueryUI: true,
aaSorting: [ [0,"desc"], [1, "desc"] ],
bDeferRender: true,
bStateSave: true
}
).columnFilter
(
{aoColumns:
[
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" }
]
}
);
}
);
</script>
所以,你想要做個人專欄過濾就像這裏:https://datatables.net/release-datatables/examples/api/multi_filter.html?在這種情況下,您至少應該在腳註中添加一些輸入字段並執行其餘的exapmle代碼。 – mainguy
爲什麼不能像這樣以更簡單的方式完成:http://www.datatables.net/forums/discussion/5033/datatables-column-filter-add-on-for-the-data-table/p1 。作者聲稱:「此代碼在表格的頁腳中添加了簡單的文本過濾器。」 –