Hello,

I'm trying to use collection select to implement filtering for my page. The 
idea is there are a bunch of posts and I want to implement record filtering 
for those.

The first collection box would have parameters like "Date", "Amount", 
"Category" and based on the selection of this a secondary drop down would 
appear and allow the user to make a selection. The records on this page 
would be then filtered based on both the selection.

I have been trying out many things and have googled a lot on collection but 
I have reached a dead end now. I'm pretty new and just started learning ROR.

You help is much appreciated here.

Thanks in advance.

Note: the code below might be wrong and as of now its not even compiling.. 
currently it complaints of "remote_function" not defined...
-----------------------------
I have a page that looks like this,

<div class="span8">

    <% if @user.spendings.any? %>

        <h3> Spendings (<%= @user.spendings.count  %>)</h3>

        

        <%= collection_select(:category, :category, Category.all, :id, :name
, 

       {:prompt => 'Select'})%>

    

    <%= collection_select :event, :filterType, Filters.all, :id, :filterType, 
{},

      {

      :onchange => remote_function(

        :url => {:action => "updatelevel", :controller => "Spendings", :id => 
1},

        :with => "'level_id='+this.value"

      )}

%>

       

        <ol class="spendings">

          <%= render @spendings %>

        </ol>

        <%= will_paginate @spendings %>

    <% end %>

  </div>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/06aea1b3-a10f-4b9d-978e-44029c8e63c6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to