Nestable icon indicating copy to clipboard operation
Nestable copied to clipboard

Added "toArray" function

Open Goktug opened this issue 12 years ago • 2 comments

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"

Goktug avatar Aug 12 '13 15:08 Goktug

/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.

peters avatar Nov 07 '13 08:11 peters

FWIW I've created a more active fork here and included your fix amongst others ;)

tchapi avatar Jan 15 '14 21:01 tchapi