nestedSortable icon indicating copy to clipboard operation
nestedSortable copied to clipboard

Dynamically Add Items

Open bettyeti opened this issue 11 years ago • 6 comments

Any documentation or demos for dynamically adding items with working event handlers? For instance adding a list item with delete?

bettyeti avatar Dec 27 '14 17:12 bettyeti

Also interested in this. I figured simply calling the function again would do the trick, but then I just get a bazillion "Uncaught TypeError: Cannot read property 'left' of undefined" errors as I try to drag.

Edit- seems to be jQuery UI that's not updating rather than the plugin. Not sure of the solution for that.

kthornbloom avatar Mar 29 '15 00:03 kthornbloom

Exemple:

$('#addNode').click(function(){
                $('ol.sortable').append('<li id="item-' + (new Date()).getTime() + '"><div>Новыей элемент</div></li>');
                $('ol.sortable').nestedSortable('refresh');
            });

Claud avatar Apr 11 '15 06:04 Claud

Yes, that works. Would be nice if that were added into the documentation!

kthornbloom avatar Apr 14 '15 13:04 kthornbloom

As far as I have used the plugin, we can simply insert the html and it will display fine (with some display glitch). No need to refresh.

(maybe we are talking about different version, I use the 2.0alpha)

phena109 avatar Sep 30 '15 16:09 phena109

Claud, not working you solution. Classes does not applyed until item is not be changed or moved.

actorius avatar Mar 04 '16 12:03 actorius

Change a bit (so that the menuItem will be added like in the example but it can´t be deleted...any tipps?

illmaren avatar Sep 16 '16 10:09 illmaren