skip to Main Content

I have a active admin filter "Tags" that contain all tags of users. Tags are loading in a collection.

The problem is what if we have thousands of tags? The page will take a lot of time to load all of them and them filter through them.

I wanted to make it dynamic through an AJAX call but I cannot find any resource related to this.

This is active admin filter

"filter :tags , label: 'Tags' , as: :select, collection: proc{ ActsAsTaggableOn::Tag.order(id: :asc).uniq.pluck(:name, :id)}"

2

Answers


  1. The question is a bit unclear, but from what I understood you want help on deciding whether you should load something dynamically or not.

    I personally think that loading it through Ajax would be a good idea as this will save loading time. To do this you can just use jQuery Ajax as per below.

    $.ajax({
      method: "POST",
      url: "file.php",
      data: { data:{/* data */} }
    })
      .done(function( msg ) {
        alert( "Data Saved: " + msg );
      });
    

    Source: jQuery Ajax

    I hope this helps! 👍

    Login or Signup to reply.
  2. This is a popular problem. Therefore, there is a popular solution.

    gem activeadmin_addons (search-select-filter)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search