Nestable
Nestable copied to clipboard
Added "toArray" function
I designed to work seamlessly with the nested sets model
Usage:
$('#list').nestable('toArray');
Results:
'1' ...
'item_id' => "1"
'parent_id' ...
'depth' => "1"
'left' => "2"
'right' => "7"
'2' ...
'item_id' => "2"
'parent_id' => "1"
'depth' => "2"
'left' => "3"
'right' => "6"
'3' ...
'item_id' => "3"
'parent_id' => "2"
'depth' => "3"
'left' => "4"
'right' => "5"
'4' ...
'item_id' => "4"
'parent_id' ...
'depth' => "1"
'left' => "8"
'right' => "9"
'5' ...
'item_id' => "5"
'parent_id' ...
'depth' => "1"
'left' => "10"
'right' => "21"
/cc @dbushell Could you please merge this? It works as expected. It's silly to have to maintain a fork with PR's that contribute significat improvements to the library.
FWIW I've created a more active fork here and included your fix amongst others ;)