0
我正在使用footable.But搜索功能在渲染窗體時無法使用,而且我在下面包含了文件。在導軌中渲染部分表單時,搜索功能無法工作4
控制器
def leave_summary
if params[:summary].present?
@leave_summary = LeaveTaken.where(:teacher_id => params[:summary])
render :partial => "leave_detail"
end
end
視圖(leave_summary.html.erb)
<i class='icon-list'> Leave Summary</i>
<% end %>
</li> <% content_for :sidebar do %>
<ul class="nav nav-tabs nav-stacked">
<li>
<%= link_to "Leave management", "#", {class: 'text-center', style: "background-color:#c4c4c4;" } %>
</li>
<li>
<%= link_to new_leave_type_path do %>
<i class='icon-list'> Add Leave Type</i>
<% end %>
</li>
<li>
<%= link_to new_leave_apply_path do %>
<i class='icon-list'> Apply Leave</i>
<% end %>
</li>
<li>
<%= link_to leave_applies_path do %>
<i class='icon-list'> Leave Approval</i>
<% end %>
</li>
<li>
<%= link_to leave_summary_path do %>
<li>
<%= link_to my_leave_path do %>
<i class='icon-list'> My Leave</i>
<% end %>
</li>
</ul>
<% end %>
<div class='row-fluid clear'>
<div class='box gradient'>
<div class='title'>
<h3 style='margin-left:1em'>My Leave</h3>
</div>
<div class='content'>
<div class="control-group string optional student_gender">
<label class="string optional control-label" for="student_gender">Teacher Code</label>
<div class="controls">
<%= select_tag "leaves", options_from_collection_for_select(Teacher.all, "id", "teacher_code"), :prompt => "--Select Employee No--" %>
</div>
</div>
<div id = "leaves_apply">
</div>
</div>
</div>
</div>
_leave_detail.html.erb
<p class='pull-right'>
Search: <input id="filter" type="text">
</p>
<table class='footable' data-page-navigation=".pagination" data-filter="#filter" data-page-size="10" data-page-previous-text="prev" data-page-next-text="next">
<thead>
<tr class ="info">
<th>Leave Type</th>
<th>Leave Entitled</th>
<th>Leave Taken</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
<% @leave_summary.each do |i| %>
<tr class = "info">
<td><%= i.leave_type.leave_name %></td>
<td><%= i.leave_type.leave_count %></td>
<td><%= i.leave_type.leave_count - i.leave_balance %></td>
<td><%= i.leave_balance.to_i %></td>
</tr>
<% end %>
</tbody>
</table>
這裏Fotable搜索無法正常工作。
什麼叫 「不工作」 是什麼意思?我認爲這篇文章可能是一個很好的解讀:http://nofail.de/2013/10/debugging-rails-applications-in-development/ – phoet