[英]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 req/param_catagory
上启动ajax请求
get and assign data and load it over data table 获取并分配数据并将其加载到数据表中
you can use jquery data table plugins for that 您可以使用jQuery数据表插件
There are few easy jquery plugins for that example: jquery data table 该示例有几个简单的jquery插件: jquery数据表
Hope this will help. 希望这会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.