Login Register

suggestion for dojo.dnd.Container: callback functions onItemInsert, onItemDelete

Hi!
Suppose that I want to do something with an item right after it has been inserted into the container (not moved within the same container) or right before it is deleted (moved to another container).
I haven't found a simple way to do this. Excuse me if there is one and please point me to the right direction. If there is not, my suggestion is that Container constructor recognize additional parameters: onItemInsert and onItemDelete of type function(container, data [,thisObj])

That's all for the suggestion, now I provide an example when this could be useful:

Let's have a container with items and let other objects (outside container) have references to these items. Further, let every item in the container hold a list of objects that reference this item. Whenever an item is deleted from the container, it will notify objects from its list that their reference is no longer valid. For this, the onItemDelete callback function would come in handy.

You proposal sounds good.

You proposal sounds good. Please open an enhancement ticket for that.

Ticket opened