Comments (7)
Hi @bancroftway ,
have you cleared he Dropzone before assigning the new items? Check #23
from blazor-dragdrop.
In the example I cited above, where would I write the code for clearing the dropzone? I tried OnParameterSetAsync, but got this error:
Just to be clear, the component's Items property is not being "set", but is "bound" to a Linq expression.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Sequence contains no matching element System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable
1[T] source, System.Func2[T,TResult] predicate) <0x321ea60 + 0x0011a> in <filename unknown>:0 at Blazor.DragDrop.Core.DragDropService.ClearDropzone (System.String dropzoneName) <0x3217a68 + 0x00030> in <filename unknown>:0 at DPlan.Client.UIComponents.SkidPatternCmp.OnParametersSetAsync () [0x00001] in C:\Projects\UIComponents\SkCmp.razor:64 at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync () <0x2d26980 + 0x00014> in <filename unknown>:0 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x2d26380 + 0x00146> in <filename unknown>:0
from blazor-dragdrop.
Did you pass the correct Dropzone Name?
Nevertheless, If you can provide a small example project I can take a further look at the issue.
from blazor-dragdrop.
I have a reproduction here.
In this project, from the Customers dropdown, first select Customer1, and then Customer2. The Customer2's orders get appended to DropZone as shown in screenshot. I am wondering, where exactly would I code the Dropzone.Clear in this case.
from blazor-dragdrop.
Try
private async Task HandleCustomerSelection(ChangeEventArgs e)
{
if (e.Value != null && !string.IsNullOrEmpty(e.Value.ToString()))
{
DragDropService.ClearDropzone("dZone");
SelectedCustomerId = new Guid(e.Value.ToString());
StateHasChanged();
}
}
from blazor-dragdrop.
@Postlagerkarte while the provided solution works, it is a bit unclean, in that the parent component is intimately aware of the child component's inner workings, breaking encapsulation.
Secondly, if the Order has a property IsDeleted to soft-delete an order, and the requirement is that when user presses 'Delete' button on an order, the order should be removed from the list, in such a case, how would we handle clearing and re-binding the dropzone, from within the component?
from blazor-dragdrop.
Hi @bancroftway , I agree with you but I am not planning to do any major work on the library except bugfixes until the Blazor Team has finalized how DragDrop looks like in .NET 5 Blazor.
For the second point - did you check #6 ? It shows how to remove an item when a users presses delete.
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.