I am trying to create a cascading filter on ActiveAdmin, and I am not quite sure how to go about it.
I have three models that have successive belongs_to/has_many relationships, eg A has many B's, and B has many C's.
I can create three filters like the following, and they work, but what I want to do is to limit B collection based on choice in A.
filter :b_a_name, :as => :select, :collection => A.map(&:name)
filter :b_name, :as => :select, :collection => B.map(&:name)
filter :year
Is there anyway to accomplish this on ActiveAdmin?
Thank for help in advance!
You can accomplish something like this using javascript, ie
b_a_name
b_a_name
with b_name
in your success callback b_name
with options in array
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.