<EjsGrid ...>
...
<GridEditSettings AllowAdding="true" AllowEditing="true" Dialog="DialogParams" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings>
...
</EjsGrid>
@code{
public static string Header { get; set; }
public object DialogParams = new
{
@@params = new DialogModel { Header = "Custom Dialog header" }
};
}
|
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" Height="315">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog">
<HeaderTemplate>
@{
var text = GetHeader((context as Order));
<span>@text</span>
}
</HeaderTemplate>
<FooterTemplate>
<SfButton OnClick="@Save">@ButtonText</SfButton>
<SfButton OnClick="@Cancel">Cancel</SfButton>
</FooterTemplate>
</GridEditSettings>
...
</SfGrid>
@code{
SfGrid<Order> Grid { get; set; }
public List<Order> Orders { get; set; }
public string Header { get; set; }
public string ButtonText { get; set; }
public string GetHeader(Order Value)
{
if (Value.OrderID == null)
{
ButtonText = "Insert";
return "Insert New Order";
}
else
{
ButtonText = "Save Changes";
return "Edit Record Details of " + Value.OrderID.ToString();
}
}
public void Cancel()
{
Grid.CloseEdit(); //Cancel editing action
}
public void Save()
{
Grid.EndEdit(); //Save the edited/added data to Grid
}
...
}
|
This line gives me an error.
@@params = new DialogModel { Header = "Custom Dialog header" }
And what is DialogModel
Hi Jens,
Based on the reported problem, we would like to inform you that after the
Volume 2020 Volume 2 release, the property has been changed from 'object' to
'DialogSettings.' If you want to change the header in the dialog, we suggest using
'HeaderTemplate' in 'GridEditSettings.' Please refer to the code snippet and
sample below for your reference.
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@Syncfusion.Blazor.Grids.EditMode.Dialog" Dialog="@dialogParams">
<HeaderTemplate> Custom Dialog Header </HeaderTemplate> <FooterTemplate> Check footer </FooterTemplate> </GridEditSettings>
|
Reference:
https://blazor.syncfusion.com/documentation/datagrid/dialog-editing#customize-the-edit-dialog
https://blazor.syncfusion.com/documentation/release-notes/18.2.44?type=all#grid
Regards,
Prathap S
I am interested in the header parameter not the width and shoqicon, but I cannot use header in your example.
I want to remove the details on xx header an
After the release of Volume 2 in 2020, the property has been changed from 'object' to 'DialogSettings.' So, if you want to change the header in the dialog, we suggest using 'HeaderTemplate' in 'GridEditSettings.' In the Dialog setting, we support the property mentioned in the link below. Kindly refer to the following UG for your reference
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.DialogSettings.html