I am populating a Twitter bootstrap accordion with data from my Rails app and I am looking to be able to filter the data. I have found some nice jQuery plugins but none seem to filter the data. Is this because it is not a simple list? Edit: Not using a list anymore. This is the code I have so far:
<div id="descriptions">
<% unless @subcategories.nil? %>
<form class="filterform" action="#">
<input class="filterinput" type="text">
</form>
<div id="list" class="display-subcategory">
<div class="accordion" id="accordion2">
<% @subcategories.each do |s| %>
<% unless s.description == "No description yet"%>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle purple-text" data-toggle="collapse" data-parent="#accordion2" href="#collapse<%=s.name.gsub(/\s+/, "")%>">
<h3><%= s.name %> </h3>
</a>
</div>
<div id="collapse<%=s.name.gsub(/\s+/, "")%>" class="accordion-body collapse out">
<div class="accordion-inner">
<%= s.description.html_safe %>
</div>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
And this is the plugin I am using: http://anthonybush.com/projects/jquery_fast_live_filter/
Edit: I am no longer going to use this plugin and I am going to attempt to write my own filter function.
I am trying to filter by the name of the items but I can’t figure this out and would appreciate some assistance. Thanks.
This is the jQuery I used to filter my accordion, I used this jfiddle to help http://jsfiddle.net/U8T8p/10/:
So this uses a regex to find my accordion headers and hides them if they don’t match the input. Hope this helps someone else anyway.