DropDownList Filtering is not working
When typing in filter box no filtering is applied.
<SfDropDownList Width="200px"
TItem="DropDownElement<string>"DataSource="@dropDownDataSource"
TValue="string"
AllowFiltering="true"
FilterType="@FilterType.Contains"
Value="@name">
<DropDownListFieldSettings Value="Value" Text="Text" GroupBy="GroupBy"></DropDownListFieldSettings>
<DropDownListEvents TItem="DropDownElement<string>"
TValue="string"
ValueChange="@((e) => OnNameSelected(e.Value))">
</DropDownListEvents>
</SfDropDownList>
public class DropDownElement<T>
{
public T Value {get; set;}
public string Text {get; set;}
public string GroupBy {get; set;}
}
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
JM
Jeyanth Muthu Pratheeban Sankara Subramanian
Syncfusion Team
October 14, 2020 01:44 PM UTC
Hi Yaroslav,
Thanks for contacting Syncfusion support.
We have checked the attached code snippet. Based on the provided information, we found that you have used Value for Dropdownlist. We suggest you to use @bind-Value for the Value property. We would like to know you that filtering operation takes place by comparing the typed value with the text. Also we have checked the Filtering works good in our end. Please find the code snippet and the sample below for your reference.
Code snippet:
|
@using Syncfusion.Blazor.DropDowns
<SfDropDownList Width="200px"
TItem="DropDownElement<string>"
DataSource="@dropDownDataSource"
TValue="string"
AllowFiltering="true"
FilterType="@FilterType.Contains"
@bind-Value="@name">
<DropDownListFieldSettings Value="Value" Text="Text" GroupBy="GroupBy"></DropDownListFieldSettings>
<DropDownListEvents TItem="DropDownElement<string>"
TValue="string"
ValueChange="@((e) => OnNameSelected(e.Value))">
</DropDownListEvents>
</SfDropDownList>
@code {
public string name { get; set; } = "AValue";
public class DropDownElement<T>
{
public T Value { get; set; }
public string Text { get; set; }
public string GroupBy { get; set; }
}
List<DropDownElement<string>> dropDownDataSource = new List<DropDownElement<string>>()
{
new DropDownElement<string>() {Text = "AText", Value="AValue", GroupBy="string" },
new DropDownElement<string>() {Text = "BText", Value="BValue", GroupBy="string" },
new DropDownElement<string>() {Text = "1Text", Value="1Value", GroupBy="int" },
new DropDownElement<string>() {Text = "2Text", Value="2Value", GroupBy="int" },
};
public void OnNameSelected(object args)
{
}
}
|
Sample: https://www.syncfusion.com/downloads/support/forum/158647/ze/Dropdownlist_Filtering211548012
Screenshot:
|
|
Kindly check the sample and get back to us if you need any further assistance on this.
Regards,
Jeyanth.
Marked as answer
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
YN Yaroslav Nozhenko
- Oct 13, 2020 07:41 AM UTC
- Oct 14, 2020 01:44 PM UTC