简体   繁体   中英

Toggle categories in a table in Ruby on Rails

I am trying to create a page that shows a table that contains products and I would like for the user to be able to toggle the categories. For example, if there are categories jeans, shirts and jackets, I would like a set of checkboxes that would toggle between showing the three categories of products. The problem is that I am unsure of how to approach this problem. I am not sure how to allow the user to relay the information to the controller without changing every users toggled categories. I also don't know how to get around the fact that refreshing the page to refresh the table would simply reset all of the categories.

you can do it in this way,

  • based upon event click of checkbox fire up ajax request on get req/param_catagory

  • get and assign data and load it over data table

  • you can use jquery data table plugins for that

  • There are few easy jquery plugins for that example: jquery data table

Hope this will help.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM