在rails中使用treeview, 请问大家有什么好的插件,或是有什么好的解决方案?需求是需要显示大量的数据,然后,需要直接在树状图上新增,修改删除。有什么办法可以解决的?先谢谢大家了。
acts_as_tree可以吗,简单又常用
[code="ruby"] class Category < ActiveRecord::Base
acts_as_tree :order => "name"
end[/code]
Example:
root
_ child1
_ subchild1
_ subchild2
[code="ruby"] root = Category.create("name" => "root")
child1 = root.children.create("name" => "child1")
subchild1 = child1.children.create("name" => "subchild1")
root.parent # => nil
child1.parent # => root
root.children # => [child1]
root.children.first.children.first # => subchild1[/code]