【发布时间】:2014-03-03 12:01:12
【问题描述】:
页面显示带有列名的脚,但没有用于输入列过滤器值的位置。 我查看了数据表网站上的示例以及堆栈溢出网站中的其他示例,发现不知道如何修复它。 任何帮助或建议如何解决此问题将不胜感激。 谢谢。
<% provide(:title, 'TBMs Daily Progress') %>
<% if signed_in? %>
<h3>TBMs Max Station by day - Today's date: <%=@current_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: " %>
<%=@tbms_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: " %>
<%=@tbms_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>
【问题讨论】:
-
所以你想像这里一样进行单独的列过滤:datatables.net/release-datatables/examples/api/…?在这种情况下,您至少应该在页脚中添加一些输入字段并实现其余的示例代码。
-
为什么不能像这里一样以更简单的方式完成:datatables.net/forums/discussion/5033/…。作者声称:“这段代码在表格的页脚添加了简单的文本过滤器。”
标签: ruby-on-rails ruby datatables