# Example of using "sortable-element" with nested lists?

**URL:** <https://www.ruby-forum.com/t/example-of-using-sortable-element-with-nested-lists/135779>\
**Category:** Rails\
**Created:** [April 24, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/example-of-using-sortable-element-with-nested-lists/135779 "2008-04-24T22:00:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 24, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/example-of-using-sortable-element-with-nested-lists/135779/1 "2008-04-24T22:00:35Z")

</div>

I am having some trouble understanding how to use my controller to  
look at what sortable-element gives me back for a nested list.

What I get back in my session looks like:  
{“list”=\>{“0”=\>{“6”=\>{“id”=\>“64”}, “11”=\>{“id”=\>“120”},  
“7”=\>{“id”=\>“65”}, “12”=\>{“id”=\>“121”}, “8”=\>{“id”=\>“69”},  
“13”=\>{“id”=\>“144”}, “9”=\>{“id”=\>“75”}, “id”=\>“18”, “0”=\>{“id”=\>“32”},  
“1”=\>{“id”=\>“33”}, “2”=\>{“id”=\>“31”}, “3”=\>{“id”=\>“35”},  
“4”=\>{“id”=\>“15”, “0”=\>{“id”=\>“17”}}, “10”=\>{“id”=\>“84”},  
“5”=\>{“id”=\>“58”}}, “1”=\>{“id”=\>“50”}, “2”=\>{“id”=\>“125”},  
“3”=\>{“id”=\>“126”}, “4”=\>{“id”=\>“133”}}

I can find lots of examples for simple lists, but am having trouble  
expanding that in my head to handle nested lists. Can anyone point me  
to an example of what the controller code might look like?

Thanks in advance,

Alan

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [May 18, 2008, 7:09pm UTC](https://www.ruby-forum.com/t/example-of-using-sortable-element-with-nested-lists/135779/2 "2008-05-18T19:09:56Z")

</div>

Hi Alan,

Did you sort this out? I think one key would be to interpret what  
those numbers are. What does your original list look like and what are  
the ids of the elements?

DAZ
