Nested tree view with Ruby on Rails

Dear All,

In ROR, I have a model ‘Document’, which may contain Section, Table, Text_field. Therefore, I have 4 models, and I use ancestry for Section as it may contain Sub-Section. Also, Table and Text_field belongs to Document, and optionally belongs to Section. So, structure will look like below:

I could successfully iterate and print this structure as List in my view. But I would like to show the data as Treeview. Is there a way I could achieve this with Ruby on Rails?

Thanks for any suggestions.

Dear All,

In ROR, I have a model 'Document', which may contain Section, Table, Text_field. Therefore, I have 4 models, and I use ancestry for Section as it may contain Sub-Section. Also, Table and Text_field belongs to Document, and optionally belongs to Section. So, structure will look like below:

I could successfully iterate and print this structure as List in my view. But I would like to show the data as Treeview. Is there a way I could achieve this with Ruby on Rails?

Can you describe or refer to an example of a tree view? What is that exactly? Do you mean something like the ancient Windows 3 little [+] and [-] controls to expand and collapse a list?

Walter

try this gem.

https://github.com/collectiveidea/awesome_nested_set