Hi
I have almost got my datagrids working as I need, but just can't seem to get the last part working. If possible, I would like to check that what I'm trying to do can actually be done before spending any more time on it.
Many thanks for your help
Andy
Summary
Hierarchy Grid – I cannot get a dialog edit template to work
with both the parent and child datagrids. It works with the parent but not the child.
Notes
I have included a cut down version of my code in index.razor
with simulated data. Don’t worry about the appearance and the async database access,
it all works fine in my original.
Details
I use the DataGrid as a Hierarchy grid to show parent and
child data. This works perfectly.
I have added the facility to edit the parent data in a Template
controlled dialog box, also this works perfectly.
When I click save I can capture the updated data in the
parent dialog which I then use in a stored procedure to update the database with.
I have shown this here….
{
if
(Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
var changedData = Args.Data; // normally has stored procedure access here
}
}
I can expand the child data in the grid. This also works as
expected
I now need to edit the child data in another dialog box
If I use a templated dialog box, if fails on 'var
SelectedEntry = (context as MChild);' being
null
@{
var SelectedEntry = (context as MChild);
}
<div>
<div class="form-row">
<div class="form-group col-md-12">
<label class="e-float-text
e-label-top">Sample child text</label>
<SfTextBox ID="Childtext" @bind-Value="@(SelectedEntry.Childtext)" Multiline="true"></SfTextBox>
</div>
</div>
</div>
</Template>
If I ‘rem’ the above section out and I don’t use a templated dialog, the
standard dialog works but I don't know how to capture the ‘Save’ Event from the standard save
button.
Hoped resolution
Confirmation that I can use the parent child hierarchy grid
as I described. It would be better if I can use it with the templated dialog box
Even better if you could point me in the way of a similar
example.
|
<GridEditSettings AllowEditing="true" Mode="@EditMode.Dialog">
<Template Context="childDialog">
@{
var SelectedEntry = (childDialog as MChild);
}
...
</Template>
</GridEditSettings>
|