PDA

View Full Version : DataView+refresh+DnD problem



hungarydan
21 Feb 2009, 3:52 PM
Hi all,

I have got a simple setup. A DataView with a JsonStore.
The DataView is rendered into the document.body and is working properly. After entering a query to a search form the proper things show up in the DataView so again it works perfectly.
However I have a little bit of trouble with Drag and Drop...
So I'd like to enable DnD on all items in the DataView thererfore I do this:


Ext.each(myDataView.store.data.item, function(item, index, allitems){
item.data.dd = new Ext.dd.DDProxy('id_of_element', 'group');
});
However this isn't working for some reason. I tried mostly everything I could think of. The interesting thing is that when I manually enter the the line above into firebug with the proper values for the id and such DnD works. The only thing I can think of right now is that this loop runs earlier than the datastore is actually updated and refreshed (Async call?).
I hope you guys can help me...

hungarydan
22 Feb 2009, 3:30 AM
I found the solution...

It turned out that I had to add 'ext-comp-' in front of the id as Ext adds this in front of the ID.

This way it works :)

Animal
22 Feb 2009, 3:34 AM
Wasteful.

Don't create a DDProxy for every item.

Create a DragZone based on the DataView's element just like in examples/dd/....