Comments (6)
I added support for this. If you want the item to be copied instead of moved you can now make use of the "CopyItem" attribute:
<Dropzone CopyItem="(item)=> { return new TodoItem() {Titel = item.Titel}; }" Items="MyThirdList" TItem="TodoItem" OnItemDrop="@((i)=>lastdropped = i)">
<div style="border: 2px solid black">
@context.Titel
</div>
</Dropzone>
The CopyItem attribute expects a method telling the dropzone how to create a copy of the item. It receives the currently active item as input.
from blazor-dragdrop.
@TarasBounty : Copy items should work now - thus I am closing this issue - if copy does not work, let me know so I can reopen. For your second issue , if is still relevant, please open a separate issue. Thank you!
from blazor-dragdrop.
Hi @TarasBounty - currently the item is removed from the source dropzone - there is no "copy" option yet. Have you tried readding (a deep copy) of your item to your source list after the drop event?
from blazor-dragdrop.
Thanks for your quick response!
Yeap, I tried readding item to the source list. It adds an item to the end of the list. For example from the screenshot above, if I drag the button to the editor panel, the button goes to the end of the toolbox list after DataGridView. It is not what I expected.
Maybe I need to know initial position in first list. Also if I dragged a button to the editor, I also want to drag one more button, but in list button already exists and it is not copying.
Maybe you have some ideas or suggestions?
Also do you have any plans to implement the "copy" option?
from blazor-dragdrop.
@Postlagerkarte great! Thanks for your work! I will check and use it!
from blazor-dragdrop.
I am trying to use logic like this.
In the loop I create 3 zones, then from one list (LayoutItems) I am trying to get necessary items with LINQ.
@foreach(var zone in _dropzones)
{
var items = LayoutItems.Where(x => x.ZoneName == zone).ToList();
<Dropzone Items="items" TItem="MyItem" OnItemDrop="(i) => i.EditorDropzone = zone">
<div style="border: 2px solid black"></div>
</Dropzone>
}
All displayed as expected and items can drag-drop between zones. But I can not change items order in any zone.
I understand why it can't be done. But maybe you can get advice how I can do logic like this? It is possible?
from blazor-dragdrop.
Related Issues (20)
- Startup.cs vs Program.cs and ActiveItem equals null HOT 2
- not working in newest chrome release HOT 2
- Blazor Server .NET 6 mobile drag n drop HOT 1
- Multiple Dropzone and Linq Items not work
- Doesn't work on mobile? OnItemDrop never triggers. HOT 4
- CSS grid support HOT 3
- .NET 6.0 Program.cs
- Doesn`t work with MAUI Blazor HOT 1
- inprogess / inprogress misspellings
- File drop possible?
- DropZone - when you incidentally start dragging dropzone caption down, after that dragging an item shows dragging all items HOT 1
- Cannot add new/remove items to list when one item was dragged from one list to another HOT 1
- [Question] OrderPossiton not Available ? HOT 6
- Support for handle
- How to use it with Virtualization?
- Stop drop if item belongs to another dynamically created dropzone of same type?
- Read the order position of list items
- [Question] Multiple drops of single item
- [Feature Request] Expose containing div HOT 1
- website with examples is stopped HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazor-dragdrop.