SfMultiSelect not working correctly
Hi,
We're trying to use the SfMultiSelect control based on your example (@bind-Value="Product.product_type" -product_type is a string)
Also how do we use the CustomValueSelection event?
When added a custom value (Apple) we get the results below, what are we doing incorrectly?
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
PO
Prince Oliver
Syncfusion Team
October 28, 2020 11:36 AM UTC
Hi Alex,
Thank you for contacting us.
Query 1: We're trying to use the SfMultiSelect control based on your example (@bind-Value="Product.product_type" -product_type is a string). When added a custom value (Apple) we get the results below, what are we doing incorrectly?
The Value property in the multiselect is of TValue type which supports string[] / int[]. So we suggest you to define the “product_type” as string[] and assign the value in that type to the control.
|
public string[] product_type = new string[] { "Apple" }; |
Query 2: Also how do we use the CustomValueSelection event?
The CustomValueSpecifier event triggers when a custom value is selected
|
<SfMultiSelect TValue="string[]">
<MultiSelectEvents TValue="string[]" CustomValueSpecifier="@SelectCustom"></MultiSelectEvents>
</SfMultiSelect> |
Kindly refer to the following UG documentation link: https://blazor.syncfusion.com/documentation/multiselect-dropdown/custom-value/
Regards,
Prince
Marked as answer
PH
Philippe
January 4, 2021 04:52 AM UTC
Hi
I have the same problem
Query 2: Also how do we use the CustomValueSelection event?
The CustomValueSpecifier event triggers when a custom value is selected
All the answer you give don t explain
It s my code
<SfMultiSelect TValue="string[]"
TItem="Etiquette"
@bind-Value="@selectedEtiquettes"
Placeholder="@languageContainer.Keys["Sélectionnez"]"
Width="500px"
ShowDropDownIcon="true"
Mode="VisualMode.Box"
AllowCustomValue=true>
<SfDataManager Url="api/Etiquette" Adaptor="Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
<MultiSelectFieldSettings Text="NomEtiquette" Value="NomEtiquette">
</MultiSelectFieldSettings>
<MultiSelectEvents TItem="Etiquette"
TValue="string[]"
CustomValueSpecifier="newEtiquette
">
</MultiSelectEvents>
</SfMultiSelect>
void newEtiquette(CustomValueSpecifierEventArgs<Etiquette> args)
{
args.Item = new Etiquette() { NomEtiquette = args.Text };
}
i have problem with this line CustomValueSpecifier="newEtiquette
check picture enclosed
Thank you
Attachment: Nouveau_8fe6cf0f.zip
BC
Berly Christopher
Syncfusion Team
January 4, 2021 10:32 AM UTC
Hi Philippe,
We would like to inform you that we suggest you to use the CustomValueEventArgs for the CustomValueSpecifier event for the MultiSelect component. Please refer the below code snippet.
|
<SfMultiSelect TValue="string[]"
TItem="EmployeeData"
@bind-Value="@selectedEtiquettes"
Placeholder="Sélectionnez"
Width="500px"
ShowDropDownIcon="true"
Mode="VisualMode.Box"
AllowCustomValue=true>
<SfDataManager Url="https://ej2services.syncfusion.com/production/web-services/api/Employees" Adaptor="Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
<MultiSelectFieldSettings Text="FirstName" Value="FirstName">
</MultiSelectFieldSettings>
<MultiSelectEvents TItem="EmployeeData"
TValue="string[]"
CustomValueSpecifier="newEtiquette
">
</MultiSelectEvents>
</SfMultiSelect>
@code{
public void newEtiquette(Syncfusion.Blazor.DropDowns.CustomValueEventArgs<EmployeeData> args)
{
}
} |
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Custom_Value_159155-967349744
Regards,
Berly B.C
PH
Philippe
January 4, 2021 06:45 PM UTC
Thank you for your rapid answer
I can trap the new custom value but the string missing the last character
Like args.NewData.NomEtiquette suppose to be House but i find Hous
public void newEtiquette(Syncfusion.Blazor.DropDowns.CustomValueEventArgs<Etiquette> args)
{
if (args.NewData.EtiquetteId == 0)
{
new Etiquette() { NomEtiquette = args.NewData.NomEtiquette };
Etiquette record = new Etiquette() { NomEtiquette = args.NewData.NomEtiquette };
dbEtiquette.AddEtiquette(record);
}
}
BC
Berly Christopher
Syncfusion Team
January 5, 2021 08:23 AM UTC
Hi Philippe,
While select the custom value, we got the exact value which is entered in the MultiSelect component without any losing characters. Please find the screenshot below.
Screenshot:
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Custom_Value_159155-967349744
Still issue persists, please share any issue reproducing sample or modify the attached sample with the reported issue that will help us to proceed further at our end.
Regards,
Berly B.C
SIGN IN To post a reply.