This is a migrated thread and some comments may be shown as answers.

triggering combo box events programmatically

3 Answers 3770 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 23 Jun 2013, 01:48 PM
I have a combo box set up to cascade to another combo box. This works.  I have mapped both a change event and a select event in the "parent" - - both of which also work. I am planning to observer the state of the "parent"  knockout via the knockout-kendo plugin.  I expect this to work.

BUT - I need to be able to trigger the cascade programmatically, as well.  That is, I need to programmatically change the selected index of the "parent".  To test this in advance of mapping it in knockout,  I have a test button that successfully changes the selected item in the "parent".  So, this works.

Here is problem: neither the change event nor a select event are triggered in response to the following (which is in the test button click handler):
var cbx = $("select").data("kendoComboBox")
cbx.select(2);
That is, the combo box changes state but kendo is not triggering either of  the events.

I have tried this in various fiddles (modifying a similar situation) and it does not work there either.

This is quite important to us, so please let me know if this is not supported.

Thanks

S



3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 24 Jun 2013, 11:36 AM
Hello,

Please try with below code snippet to trigger event.

$("select").data("kendoComboBox").value(null);
$("select").data("kendoComboBox").trigger("change");


Thanks,
Jayesh Goyani
0
Stephen
Top achievements
Rank 1
answered on 24 Jun 2013, 12:03 PM
Hello Jayesh

Thanks for the reply and this indeed works, though I am exactly sure why. 

As a input to telerik, this is not in any documentation I can find - nor is the trigger function immediately obvious in the any of the fn objects under the kendo namespace.  I guess the answer is that since this is clearly a (modified) jQ event object, it should inherit the jQ trigger function - which would map tot the cached jQ events. Is that correct in your view?

Again, thanks for assist.

S
0
Alexander Valchev
Telerik team
answered on 26 Jun 2013, 09:00 AM
Hello guys,

@Stephen:
Actually the trigger method is documented - it is a common method for the kendo.ui.Widget class and is inherited from kendo.Observable.


Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Stephen
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Stephen
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or