ComboBox dynamic binding example


Hi,

can you please review the example for ComboBox Dynamic Value Binding as per the following

https://blazor.syncfusion.com/documentation/combobox/data-binding/

I found that if I copy the code into my blazor application I get the following error

The component 'ComboBoxEvents' is missing required type arguments. Specify the missing types using the attributes: 'TItem'.

IF I then add the TIem value as follows
<ComboBoxEvents TItem="Countries" TValue="string" ValueChange="onChange"></ComboBoxEvents>

I get the following error
Argument 2: cannot convert from 'method group' to 'EventCallback'

What is needed to implement dynamic binding please,?

Regards,
Jeremy







3 Replies 1 reply marked as answer

JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team October 5, 2020 07:21 AM UTC

Hi Jeremy, 

Thanks for contacting Syncfusion support. 

We have checked your query and we would like to know you that we have provided strongly typed support for ComboBox. Therefore, you need to provide the type of value and item as TValue and TItem. Based on the provided error information, we suspect that you have missed to provide TItem attribute to the event callback of ValueChange event. We have modified the sample. Please find the sample in the below link.


 

<SfComboBox Placeholder="e.g. Australia" Value="@ComboVal" DataSource="@Country"> 
    <ComboBoxEvents TItem="Countries" TValue="string" ValueChange="onChange"></ComboBoxEvents> 
    <ComboBoxFieldSettings Value="Name"></ComboBoxFieldSettings> 
</SfComboBox> 

private void onChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, Countries> args) 
    { 
        ComboVal = args.Value; 
        StateHasChanged(); 
    } 


 

Kindly check the sample and get back to us if you need any further assistance on this. 
Regards, 
Jeyanth.

 


Marked as answer

JE Jeremy October 5, 2020 07:27 AM UTC

Thanks, when are you planning on updating the documentation to match? I just checked and dynamic binding sample has not changes (it still contains the error).

It makes it very hard to use controls when the "how to" guides dont actually work.



JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team October 6, 2020 01:29 PM UTC

Hi Jeremy,  
Sorry for the inconvenience caused.  
We will correct our documentation and let you know once the documentation has published.  
We appreciate your patience.  
Regards, 
Jeyanth. 


Loader.
Up arrow icon