Coder Social home page Coder Social logo

chrissainty / simpledraganddropwithblazor Goto Github PK

View Code? Open in Web Editor NEW
121.0 9.0 44.0 227 KB

Companion code sample for my blog post - Investigating Drag and Drop with Blazor

Home Page: https://chrissainty.com/investigating-drag-and-drop-with-blazor/

License: MIT License

HTML 47.15% C# 23.50% CSS 29.36%
blazor blazor-application drag-and-drop blazor-client blazor-server

simpledraganddropwithblazor's Introduction

simpledraganddropwithblazor's People

Contributors

chrissainty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpledraganddropwithblazor's Issues

Code explanation

Hello, in JobsContainer.razor you have the method UpdateJobAsync:

public JobModel Payload { get; set; }

public async Task UpdateJobAsync(JobStatuses newStatus)
{
    var task = Jobs.SingleOrDefault(x => x.Id == Payload.Id);

    if (task != null)
    {
        task.Status = newStatus;
        task.LastUpdated = DateTime.Now;
        await OnStatusUpdated.InvokeAsync(Payload);
    }
}

I was wondering why you create the task variable and not simply change the properties of the Payload property directly:

public JobModel Payload { get; set; }

public async Task UpdateJobAsync(JobStatuses newStatus)
{
    if (Payload != null)
    {
        Payload.Status = newStatus;
        Payload.LastUpdated = DateTime.Now;
        await OnStatusUpdated.InvokeAsync(Payload);
    }
}

It looks like Payload and task reference the same object of the Jobs collection. Maybe I'm missing something. Is there any reason you did it this way?

drag & drop in Firefox

Hi Chris,

In Firefox we need an additional step to get drag & drop working. FF needs the call to ev.dataTransfer.setData("text", null) on dragstart event.
Currently, this seems impossible to do with Blazor server-side. I already made some investigation almost one year ago.
The main problem seems to be that the ondragstart attribute must be used for Blazor's event handling and can no longer be used for a js call. When calling a JS function through interop and passing the DragEventArgs from Blazor the method setData cannot be called.

However, it would be great if you find another way to get it working.

Regards
Sven

Change the order of Events

Hi, is it possible to change the order in a dropzone by moving one event before another?
I am very much looking forward to a feedback. Thanks.

NuGet package

Hi!

Any chance of a NuGet package? It would really make it easier to use this library.

Great work!
Thanks.

Add Touch support

Is there a way to add touch support to the demo?
I tried hooking up to the ontouchstart or other ontouch... events but Container.Payload is always null. Any idea?

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.