Tiago
Tiago

Reputation: 733

Visibility checkboxes in ActiveAdmin

I have a resource in ActiveAdmin that contains a index table.

This table has about 15 columns.

Is there an easy way to have some checkboxes (or some other thing) for the user to choose which columns to display, and which to hide?

Upvotes: 0

Views: 461

Answers (2)

Sachin R
Sachin R

Reputation: 11876

It can be tricky. Use columns names in some table. for eg : activeadmin_columns

 id, model_name, cols_array, user_id
 1, User, ["first_name", "last_name", "email"], 2

Now in users.rb

ActiveAdmin.register User do
    index do
        current_user.activeadmin_columns.cols_array.each do |col|
          column :"#{col}"
        end
    end
end

This will only show the column which is coming from db. This is just overview it require more effort. :)

Upvotes: 1

Pinaev
Pinaev

Reputation: 48

You can use filter function in activeadmin. If you use filter, you can see something you select.

Upvotes: 0

Related Questions