Filtering on GridForeignColumn
Hi,
I am using a foreign column to display list of employees. I would like to be able to filter (contain) the list of employees in the drop down box, but even with AllowFiltering="true" FilterSettings="@(new FilterSettings{ Operator = Operator.Contains })", I can't get any filtering.
Thanks for your help.
ma
<SfGrid TValue="ConfigOwnerBusinessLine" Height="315" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })"
AllowResizing="true" AllowReordering="true" AllowGrouping="false" AllowPaging="true" AllowFiltering="false" AllowSelection="true" AllowExcelExport="false">
<SfDataManager Url="api/OwnerBusinessGrid" InsertUrl="api/OwnerBusinessGrid/Insert" UpdateUrl="api/OwnerBusinessGrid/Update" RemoveUrl="api/OwnerBusinessGrid/Delete" Adaptor="Syncfusion.Blazor.Adaptors.UrlAdaptor" CrossDomain=true></SfDataManager>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridPageSettings PageSize="7"></GridPageSettings>
<GridColumns>
<GridColumn Field="Id" HeaderText="Id" IsPrimaryKey="true" IsIdentity="true" Visible="false"></GridColumn>
<GridForeignColumn Field="Employee" ForeignKeyField="Id" ForeignKeyValue="FullName" ForeignDataSource="@EmployeeList" HeaderText="Employé" AllowFiltering="true" FilterSettings="@(new FilterSettings{ Operator = Operator.Contains })" Type="ColumnType.String"></GridForeignColumn>
<GridColumn Field="IsActive" HeaderText="Actif" Type="ColumnType.Boolean"></GridColumn>
</GridColumns>
</SfGrid>
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
JP
Jeevakanth Palaniappan
Syncfusion Team
January 15, 2021 05:24 AM UTC
Hi Martin,
Greetings from Syncfusion support.
We have validated your query and found that you have disabled the AllowFiltering property in SfGrid. To perform filtering this property has to be enabled in SfGrid. If your set it to false in SfGrid then you cannot able to be perform filtering in all the columns. Incase if you don’t want to disable filtering for a particular column then you have set AllowFiltering as false in the GridColumn only.
Please get back to us if you have any other queries.
Regards,
Jeevakanth SP.
MA
Martin Ares
January 15, 2021 02:01 PM UTC
Hi,
Unfortunately, the Grid filter provides filtering for the existing values in the grid. In my case, I want to be able to filter values in the drop down (from the foreign column) whenever I neet to change the value. ie: the grid contains a list of assigned employees with an active flag. If I want to add a line item (employee), I need to be able to search for the employee on the newly created row drop down. Even with the filter option at true on the grid level, this does not work.
tks,
ma
JP
Jeevakanth Palaniappan
Syncfusion Team
January 18, 2021 01:44 PM UTC
Hi Martin,
To filter in the dropdown, we suggest you to set the AllowFiltering as true in the EditorSettings of that particular grid column. Please refer the below code snippet, documentation and the sample for your reference.
|
<GridForeignColumn Field=@nameof(Order.EmployeeID) HeaderText="Employee Name" ForeignKeyValue="FirstName" ForeignDataSource="@Employees" Width="150" EditorSettings="@ShipNameEditParams"></GridForeignColumn>
@code{
public IEditorSettings ShipNameEditParams = new DropDownEditCellParams
{
Params = new DropDownListModel<object, object>() { AllowFiltering = true, ShowClearButton = true }
};
}
|
Please get back to us if you have any other queries.
Regards,
Jeevakanth SP.
Marked as answer
MA
Martin Ares
January 18, 2021 02:48 PM UTC
Thank you, that works fine! I am just missing an option to search with "contains" instead of "starts with". In the grid I could use "FilterSettings = "@(new FilterSettings{ Operator = Operator.Contains })", but this is not possible with this mechanism.
thanks,
ma
JP
Jeevakanth Palaniappan
Syncfusion Team
January 19, 2021 04:54 AM UTC
Hi Martin,
Thanks for the update. Please get back to us if you any other queries.
Regards,
Jeevakanth SP.
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
MA Martin Ares
- Jan 15, 2021 01:41 AM UTC
- Jan 19, 2021 04:54 AM UTC