An example of simple drag and drop with Blazor.
Read the full blog post at https://chrissainty.com/investigating-drag-and-drop-with-blazor/.
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
An example of simple drag and drop with Blazor.
Read the full blog post at https://chrissainty.com/investigating-drag-and-drop-with-blazor/.
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?
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
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.
Hi!
Any chance of a NuGet package? It would really make it easier to use this library.
Great work!
Thanks.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.