RE: [flexcoders] Re: Drag & Drop conundrum... BUG?
Hi Martin, Did you see my previous reply? I've pasted it below. Thanks, Paul Previous reply: === Hi Martin, Can you post your code? Another guess: Are you using an Array or an ArrayCollection as your dataprovider? My understanding is that you must use an ArrayCollection if you want updates to propagate to the control, see below for more: http://livedocs.macromedia.com/flex/20beta1/docs/wwhelp/wwhimpl/common/h tml/wwhelp.htm?context=LiveDocs_Parts&file=2088.html Paul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of flexabledev Sent: Sunday, April 23, 2006 10:23 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Drag & Drop conundrum... BUG? I am still having a problem. This looks like it might be a bug? Once I set dropEnabled to "false", I can see (while debugging) that the contents of the Array after the Drop were Correct, i.e. no "[object Object]" items in the List. So far so good... BUT!!! Once it is set to "false" the List does not reflect the contents of the Array (it's dataProvider) after the Drop. I tested this in two ways: 1. I Initialized the [Bindable] Array to contain values before the Drop. They show up in the List as expected but when I Drop an item nothing changes! In debug mode, though, the Array contains both the initialized values and the drop items. 2. When I set dropEnabled back to "true", the drop items show up in the list, but so does the default "[object Object]" for each drop item. This now looks like a bug to me, that somehow the list control does not get notified of change to the dataProvider. To test this, I added a button that manually adds a value to the Array and the List still does not reflect the change to it's dataProvider. Any Ideas? Thanks... Martin > --- In flexcoders@yahoogroups.com, "Paul Williams" wrote: > > > > Just a guess, but one possibility is that your list's default drop > > behaviour is switched on, i.e. on the list control, dropEnabled="true". > > This could cause the item to be added twice, once by your event handler > > and once by the default drop behaviour. > > > > Paul > > > > -Original Message- > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of flexabledev > > Sent: Saturday, April 22, 2006 9:38 AM > > To: flexcoders@yahoogroups.com > > Subject: [flexcoders] Drag & Drop conundrum... > > > > I've started to experiment with Drag & Drop and have run into a > > problem I can't figure out. I have successfully written code that > > allows me to Drag rows from a DataGrid (with a custom Drag Proxy) and > > Drop the value of one of the columns into a List. The only thing I > > don't understand is why when I do a Drag & Drop, I always get two > > entries in the List for each of the rows that were dragged. If I drag > > two rows with String values that get dropped (i.e. "ONE", "TWO"), the > > result in the List after the Drop looks like: > > > > [object Object] > > [object Object] > > ONE > > TWO > > > > When I debug it, the value of items.length equals 2 > > > > which drives a For loop with > > IList(dropTarget.dataProvider).addItem(items[i].field); > > > > As I step through the doDragDrop function in debug mode, it only > > executes the loop twice, yet I end up with four entries in the List? > > > > Any ideas? > > > > I can't figure it out, but it feels like there is some default > > behaviour (dropping the "items" Object separate from my "addItem") > > occuring that I don't see when I step through it in debug mode? > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: > > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Re: Drag & Drop conundrum... BUG?
Hi Martin, Can you post your code? Another guess: Are you using an Array or an ArrayCollection as your dataprovider? My understanding is that you must use an ArrayCollection if you want updates to propagate to the control, see below for more: http://livedocs.macromedia.com/flex/20beta1/docs/wwhelp/wwhimpl/common/h tml/wwhelp.htm?context=LiveDocs_Parts&file=2088.html Paul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of flexabledev Sent: Saturday, April 22, 2006 11:27 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Drag & Drop conundrum... BUG? Paul, Thanks! I didn't know that you did not need to set dropEnabled="true" if you also set dragEnter and dragDrop handlers. I just assumed that you always needed to set dropEnabled, even if you write your own drag behaviour... Once I set dropEnabled to "false", I can see (while debugging) that the contents of the Array after the Drop were Correct, i.e. no "[object Object]" items in the List. So far so good... BUT!!! Once it is set to "false" the List does not reflect the contents of the Array (it's dataProvider) after the Drop. I tested this in two ways: 1. I Initialized the [Bindable] Array to contain values before the Drop. They show up in the List as expected but when I Drop an item nothing changes! In debug mode, though, the Array contains both the initialized values and the drop items. 2. When I set dropEnabled back to "true", the drop items show up in the list, but so does the default "[object Object]" for each drop item. This now looks like a bug to me, that somehow the list control does not get notified of change to the dataProvider. To test this, I added a button that manually adds a value to the Array and the List still does not reflect the change to it's dataProvider. Any Ideas? Thanks... Martin --- In flexcoders@yahoogroups.com, "Paul Williams" <[EMAIL PROTECTED]> wrote: > > Just a guess, but one possibility is that your list's default drop > behaviour is switched on, i.e. on the list control, dropEnabled="true". > This could cause the item to be added twice, once by your event handler > and once by the default drop behaviour. > > Paul > > -Original Message- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of flexabledev > Sent: Saturday, April 22, 2006 9:38 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Drag & Drop conundrum... > > I've started to experiment with Drag & Drop and have run into a > problem I can't figure out. I have successfully written code that > allows me to Drag rows from a DataGrid (with a custom Drag Proxy) and > Drop the value of one of the columns into a List. The only thing I > don't understand is why when I do a Drag & Drop, I always get two > entries in the List for each of the rows that were dragged. If I drag > two rows with String values that get dropped (i.e. "ONE", "TWO"), the > result in the List after the Drop looks like: > > [object Object] > [object Object] > ONE > TWO > > When I debug it, the value of items.length equals 2 > > which drives a For loop with > IList(dropTarget.dataProvider).addItem(items[i].field); > > As I step through the doDragDrop function in debug mode, it only > executes the loop twice, yet I end up with four entries in the List? > > Any ideas? > > I can't figure it out, but it feels like there is some default > behaviour (dropping the "items" Object separate from my "addItem") > occuring that I don't see when I step through it in debug mode? > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.