I know this thread is a little old, but I too have this problem and the link given doesn't help me as I cannot find what Jeevakanth is talking about. Can you elaborate how this is solved with a better example?
After a bit of trial and error I managed to get it to cooperate. I hope this example of how to do this may help someone:
<GridForeignColumn Field=@nameof(ManageUsersView.User.CustomerId)
HeaderText="Customer Link"
Width="150px"
ForeignDataSource="@customersList"
ForeignKeyValue="DisplayName"
ForeignKeyField="Id">
<EditTemplate>
Customer Link
@{
<SfDropDownList ID="UserCustomerID" @bind-Value="@((context as ManageUsersView.User).CustomerId)" TItem="Customer" TValue="int?" DataSource="@customersList" ShowClearButton="true">
<DropDownListFieldSettings Value="Id" Text="DisplayName" ></DropDownListFieldSettings>
</SfDropDownList>
}
</EditTemplate>
</GridForeignColumn>
Hi Alexander,
Greetings from Syncfusion support.
Query:” I know this thread is a little old, but I too have this problem and the link given doesn't help me as I cannot find what Jeevakanth is talking about. Can you elaborate how this is solved with a better example?”
Thanks for the detailed explanation on the update. Also we would like to inform that we can also use EditParams to enable the showclearbutton. Kindly check the attached code snippet for your reference.
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" Height="315">
<GridColumns> <GridColumn Field=@nameof(Order.OrderID) IsPrimaryKey="true" HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> <GridForeignColumn Field=@nameof(Order.EmployeeID) EditorSettings="@EditParams" HeaderText="Employee Name" ForeignKeyValue="FirstName" ForeignDataSource="@Employees" Width="150"></GridForeignColumn> </SfGrid>
@code{ public IEditorSettings EditParams = new DropDownEditCellParams { Params = new DropDownListModel<object, object>() { AllowFiltering = true, ShowClearButton = true } }; } |
Reference: https://blazor.syncfusion.com/documentation/datagrid/cell-edit-types#dropdownedit
Kindly get back to us if you have further queries.
Regards,
Monisha