As long as there is no TargetID provided for D&D the row is only dragable at the small icon on the left.
As soon as one is provided this icon disappears and the complete row becomes dragable.
How can I achieve, that the icon is not present and the row is completely dragable, while no TargetID is provided?
I tried using OnRowDataBound="RowBound" to add the e-rowdragdrop class to every row, because this works, when I do it manually in the Chrome Dev tools, but this resulted in infinite loop calling RowBound.
Hey,
thank you for the fast answer.
I am not using drag and drop within the table. I worked my way into having 6 tables I can freely drag and drop between, by using the RowDroppedEventArgs.Target.Xpath and a custom RowDropped EventHandler.
But this only works if I don't provide a target ID.
As I mentioned I can mostly achieve the desired behavior of the whole row being draggable just by adding the correct .css class to a row in Chrom directly. But doing that for each row programmatically with the RowDataBound Event leads to infinite loops in my case. That event always fires infinitely disregarding of the content of the corresponding method and I'm unsure why at the moment. But that seems to be a problem with my implementation, because the event works fine in other tables.
Regards,
Joschka
Hey,
my inquiry is about an completely cosmetic aspect by now, because I found workarounds for the rest.
I got this Data Grid
AutoFit="true">*@
It has this callback method and is part of the PmtDeckDataGrid component:
public async Task RowDropHandler(RowDragEventArgsargs)
{
Console.WriteLine(Zone.Name);
await OnRowDropped.InvokeAsync((args, Zone));
}
The parent creates 6 of those components in the following manner
@foreach (var zoneEnum in Enum.GetValues())
{
}
The event handler contains the following I commented the following code to explain what is happening.
public void OnRowDroppedEventHandler((RowDragEventArgs, Zone) packedArgs)
{
var (args, donatorZone) = packedArgs;
//Retrieves the protected Property Xpath that is contained in the OnRowDroppedEvenArgs
var xPathByReflection = (string)args.Target.GetPropertyValue("XPath");
//This method converts the string into the corresponding Enum and then gives back the correct Zone object
if (!Zone.TryGetZone(xPathByReflection, out var receiverZone))
return;
if (!Grids.ContainsKey(receiverZone))
return;
//Grids holds all references to the created DataGrids
var targetGridComponent = Grids[receiverZone];
//A Method that effectively removes the CardInfo object that was contained in the OnRowDroppedEvent from one Zone and adds it to the other zone.
targetGridComponent.Zone.MoveCard(donatorZone, args.Data.First());
}
This allows free drag and drop between my 6 different tables. As demonstrated here:
I achieved the whole row to be a dragable area, by adding the e-rowdragdrop css class to each individual cell using the CustomAttributes property of DataTables.
Now I just want to remove the small icon on the left (column -1) that is normally supposed to be the area where you drag the row.
Or in short I want it to look and behave like this example: https://blazor.syncfusion.com/demos/datagrid/row-drag-and-drop?theme=bootstrap4
And being able to drag and drop freely between multiple grids, that contain the same object type.
----
A problem that I cannot reproduce myself on different tables, but that doesn't effect me right now are the infinite event calls to OnRowDataBound if I insert it like this into to SfDataGrid I posted above.
This seems to be a very specific problem, that I cannot figure out.
The complete project source can be found here:
|
|