Handling events

Hi there.
I have two combo boxes, and I want them coordinated.

With the first one the user searches clients by code and with the second one, by name.
Both have their ComboBoxFieldSettings.value(s) properties set to ClientID field.

Both have their SfComboBox.Value properties referenced to variables, so I can set their values.


In the ValueChange eventHandlers of both, thus, after a user selects a client in one of them, I am setting the referenced value of the other combo box to the selected clientID.

This is working fine, except that by changing the referenced value of the second Compo Box, its ValueChange event handler is triggered which is setting the value of the first combo box back again.
The chain stops there because the first combo box is already set to this value and its event handler does not trigger again.
This would be unnoticeable, but there is some other code in the handler events that costs in CPU cycles and network traffic.
I would like to stop this call back of the event handlers.
I have a variable declared "SilentMode" in each combo box and if it is set, I do not 
InvokeAsync the event handler.
So, the eventHandler looks like this :
CompoBox A :
Set SilentMode ON for ComboBoxB

Set Value for  ComboBoxB

Set SilentMode OFF for ComboBoxB

The problem here is that all of this code is executed and then the ValueChange event of the  ComboBoxB is triggered, so the  SilentMode is set to OFF.

Is there a way to set the value of the combo box without triggering the ChangeEvent?


8 Replies

VJ Vinitha Jeyakumar Syncfusion Team June 16, 2022 01:28 PM UTC

Currently, we are validating your reported query. we will update you the further details in two business days on or before 20th June 2022.



UD UdhayaKumar Duraisamy Syncfusion Team June 17, 2022 12:33 PM UTC

Hi Rigakis,


We request you to modify the attached sample as per your requirement. So that we can validate the issue further and provide you with a prompt solution.


Regards,  

Udhaya Kumar D.


Attachment: BLAZcomboBox_112b45f1.zip


RI Rigakis June 17, 2022 11:30 PM UTC

Hi there.
Thanx for the immediate response.

I modified the project. 
I have two breakpoints set.
My problem is that the breakpoint in ValueChangeHandler2 is getting hit when I change the CBValue2 in the ValueChangeHandler1 handler which is hit when we select a value in comboBox 1.

I'm trying to design combo boxes which can handle thousands and thousands of records.

This demands the reading of some records in every ValueChange  event call, and I am trying to avoid it.

Thanx in advanced.


Attachment: Cboxes_88a866ed.rar


UD UdhayaKumar Duraisamy Syncfusion Team June 20, 2022 09:52 AM UTC

Hi Rigakis,


The ComboBox component has the IsInteractedBoolean property. IsInteracted property will get “true” only when the value of ComboBox is changed by user interaction. By using this property, we can customize the code inside the ValueChange event. Please refer to the below code snippet and documentation for more details.


private void ValueChangeHandler1(ChangeEventArgs<int?, Games> args)

    {

        CBValue1 = args.ItemData.ID;

        CBValue2 = args.ItemData.ID;

    }

    private void ValueChangeHandler2(ChangeEventArgs<int?, Games> args)

    {

        if (args.IsInteracted)

        {

            CBValue2 = args.ItemData.ID;

            CBValue1 = args.ItemData.ID;

            // Here, you can customize your code

        }

 

    }


Documentation : https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.ChangeEventArgs-2.html#Syncfusion_Blazor_DropDowns_ChangeEventArgs_2_IsInteracted


Regards,

Udhaya Kumar D.


Attachment: BLAZcombobox_1b821f8d.zip


RI Rigakis June 20, 2022 11:56 AM UTC

Hi there!

Thanx for the quick response!!!
Although this is exactly what I needed, I think there is a bug in the functionality of this feature.
I'm sending you a video.
Watch for the output window where I log the args.IsInteracted property.
It works fine when setting Combo Box value by code or by selecting compo box entry by mouse, 
but it fails when selecting Combo Box entry by keyboard and then pressing return.

Thanx in advance!


Attachment: 20220620_14h49_30_ee693178.rar


UD UdhayaKumar Duraisamy Syncfusion Team June 21, 2022 12:38 PM UTC

Hi Rigakis,


We have considered the reported issue as a bug from our end and will be fixed in our July 12 patch release. You can track the status of the issue by the below feedback link.

Feedback Link:  https://www.syncfusion.com/feedback/35806/isinteracted-is-get-false-when-select-item-using-keyboard-navigation 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,

Udhaya Kumar D.



UD UdhayaKumar Duraisamy Syncfusion Team July 14, 2022 03:12 PM UTC

Hi Rigakis,


We are facing complexity while resolving this issue. We will include in upcoming patch release (20th July 2022).


Regards,

Udhaya Kumar D



MM Mohanraj Mathaiyan Syncfusion Team July 23, 2022 03:50 PM UTC

Hi Rigakis,

We are glad to announce that the fix for the reported issue has been implemented in the weekly patch release 20.2.39. We request you to update the NuGet to the latest version to get rid of this issue.


Find the release notes here: https://blazor.syncfusion.com/documentation/release-notes/20.2.39?type=all#combobox


Regards,

Mohanraj M


Loader.
Up arrow icon