Custom Value reset to 0

Hello,

Our QA created a ticket regarding a custom value of ComboBox has inconsistent behavior. 
In order to verify the issue, I created a simple page with 2 TextBoxes and 1 combobox of <int, int>.

Dropdown works fine. When when I enter random number i.e., 13 then move to next tab, sometimes it takes 13 but sometimes it becomes 0 as soon as we leave the box.

FYI, I attached a screenshot of the result of taking 13.


Image_9771_1727357865641


Attachment: Syncfusion_Combo_box_Issue_6eff3c12.zip

1 Reply

PK Priyanka Karthikeyan Syncfusion Team September 27, 2024 12:35 PM UTC

Hi Tristan Kim,

 

Thank you for reaching out to us.

 

To address the issue of the ComboBox sometimes changing the entered value to 0, you should update the TItem type from int to int? in the component. This change will prevent the ComboBox from displaying '0' when the value is cleared in the input. Below is the modified code snippet for your reference:

 

​<PageTitle>Home</PageTitle>

<div>
   <SfTextBox></SfTextBox>
   <SfComboBox TValue=int? TItem=int? Placeholder="Timeout Value"
               DataSource="@TimeoutValues" Width="300px"
               @bind-Value="@TimeoutValue" AllowCustom="true"
               FloatLabelType="FloatLabelType.Always">
   </SfComboBox>
   <SfTextBox></SfTextBox>
</div>

@code {
   private int? TimeoutValue { get; set; }
   private int?[] TimeoutValues = new int?[] {10, 15, 20, 25, 30, 45, 60, 90, 120};
}


This adjustment should resolve the inconsistent behavior you are experiencing with the ComboBox when entering custom values.

 

Sample: https://blazorplayground.syncfusion.com/BZBpjkBQJyWHUAoc

 

Regards,

Priyanka K


Loader.
Up arrow icon