Giter VIP home page Giter VIP logo

Comments (6)

Postlagerkarte avatar Postlagerkarte commented on July 27, 2024 1

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.

Postlagerkarte avatar Postlagerkarte commented on July 27, 2024 1

@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.

Postlagerkarte avatar Postlagerkarte commented on July 27, 2024

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.

TarasBounty avatar TarasBounty commented on July 27, 2024

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.

TarasBounty avatar TarasBounty commented on July 27, 2024

@Postlagerkarte great! Thanks for your work! I will check and use it!

from blazor-dragdrop.

TarasBounty avatar TarasBounty commented on July 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.