Postlagerkarte / blazor-dragdrop

Easy-to-use Drag and Drop Library for Blazor
MIT License
403 stars 96 forks source link

How to inspect list? #121

Open redowl5 opened 3 years ago

redowl5 commented 3 years ago

As stated in the docs, how do you inspect the list to get current position?

image

I'm inspecting the item collection I passed in as Items and they do not get changed?

Thanks for any help

ViRuSTriNiTy commented 3 years ago

Can you please add a permalink to the relevant line in the relevant markdown file instead of a screenshot?

redowl5 commented 3 years ago

Not sure how to? But the relevant line is

"After a drag operation you can inspect your list to get the current position of items."

ViRuSTriNiTy commented 3 years ago

The permalink is

https://github.com/Postlagerkarte/blazor-dragdrop/blob/57bd6068b0c44d68e41dff880e8853b4a56cb825/README.md?plain=1#L72

FYI: You can find these in case of markdown file by opening the file in the browser via https://github.com/Postlagerkarte/blazor-dragdrop/blob/master/README.md, click Display as source, click the relevant line, click on the ... menu, click Copy Permalink.

ViRuSTriNiTy commented 3 years ago

Did you set InstantReplace to true?

Afaik only in this case the items are changed automatically.

redowl5 commented 3 years ago

I didn't know that was an option having not seen it in any of the examples. I've now added that but it's still not quite working, I can see the item moving and the UI updating but when I release the item list reverts to the original order.

ViRuSTriNiTy commented 3 years ago

Then you most likely did not setup the Accepts property correctly, right?

redowl5 commented 3 years ago

How do I use that? Do you know if there is an example?

Thanks for your help

redowl5 commented 3 years ago

Although not following how this helps with inspect your list to get the current position of items after a drag operation?

ViRuSTriNiTy commented 3 years ago

The idea is to let the component change the items collection and then you can take the changed order and persist it or something like that. Perhaps I did not understand your initial question correctly, it is somewhat vague.

redowl5 commented 3 years ago

How do you take the changed order? I can't see how I do this, that was my original question. Do you inspect the list that you passed to the Items property as we've tried that and can't see any changes to it.

Thanks again for the help.

ViRuSTriNiTy commented 3 years ago

For a possible solution have a look at the demo page ReplacedItem. Set a breakpoint in OnItemDrop and OnReplacedItemDrop to see how the fields DropedItem and replacedItem are changed.

redowl5 commented 3 years ago

Thanks!

ViRuSTriNiTy commented 3 years ago

Can we close this?