Login Register

Adding an item at a specified place in DnD src

Hi

I am trying to create a Dnd list in which buttons are there as Dnd items, now what i want to do is suppose there are 3 dnd items say 1, 2, 3 now i want to select the 2nd Dnd item and add a new item on the fly between 2 and 3 rd dnd item

Rite now if i add a new item it just adds it after the last available one say 3 in this case, can we specify where in the list to add a dnd item ??

dino

If I understand you

If I understand you correctly, you are adding items programmatically. There is a way to do it: just use source.insertNodes() method. It is documented here: http://api.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.dnd.Selector.insertNodes. More general details can be found here: http://docs.google.com/Doc?id=d764479_11fcs7s397.

Thanks Eugene

Hi Eugene

Thanks a lot, i solved the matter and yes u were correct in presuming i am adding them programatically.
Awesome API dojo has you guys have thought of everything and make my work so simple.thanks a lot ..

I have turned a pro dojo in my organisation :-D

Dino

Thank you for kind words

Thank you for kind words — we enhance Dojo continuously because we use it in our projects at our workplaces, and all improvements and ideas are coming from the real life requirements. Working together we can stand on shoulders of giants and make a better foundation for everybody.

DnD does have a room to grow. For example, we don't have an API to delete and move items programmatically (http://trac.dojotoolkit.org/ticket/5486) — nobody needed it yet, but it should be there for the completeness.

i did an implementation

Hi Eugene

I actually did an omplementation to delete a programatically added dnd item using script

Dino

You can submit the CLA

You can submit the CLA (http://dojotoolkit.org/cla) and attach your patch to the ticket — it is always easier to work against the existing code.