jQWidgets Forums
jQuery UI Widgets › Forums › General Discussions › Lists › DropDownList › select event – from user interaction or from method call?
Tagged: DropDownList, event.args.type, jqxDropDownList, select, select event
This topic contains 5 replies, has 2 voices, and was last updated by Nadezhda 10 years, 4 months ago.
-
Author
-
Dear all
I have a jwxDropdownlist and I have a select event handler function. However, I only want to execute this handler, if the selection has been made by user. I do have ‘selectedIndex: 0’ in the settings object and I also set the selection by calling selectIndex(x) in certain circumstances. So I need to distinguish where the select event comes from. I looked in the API-Doc / Examples but could not find any solution.
However, I found out by setting a break point in the select event that there is an event.args.type. I observed the following types: ‘mouse’ / ‘keyboard’ / ‘none’. Since I could not find any doc about this, I like to ask here, if this is the correct way to do what I am looking for and if there are other types I did not see right now.
Thanks in advance for your help.
– baderaHello badera,
The ‘select’ event is triggered when the user selects an item. Here is an example: http://jsfiddle.net/7chzuqpf/. I hope it would be helpful to you.
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/Dear Nadezhda
Thanks for the answer – but it is not an answer to my question. I know that the ‘select’ event is triggered when the user selects an item. But it is also triggered, when the method selectIndex(xxx) is called on this dropdown. An it is also triggered after initialisation, if selectIndex in the settings is set. -> My question is, how to distinguish these types of selection and whether it is correct to use the event.args.type and which types exists -> I did not find any info about event.args.type in the doc.
Best regards,
– baderaHi badera,
There four different event.args.type on select event:
–mouse– when select item with mouse;
–keyboard-when select item with keyboard button;
–api– when call selectIndex method after widget initialization;
–none-when call selectItem method after widget initialization.Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/Dear Nadezhda
Thanks for the clarification. It would be good, if such things would be documented in your API-Doc!!
Best regards,
– baderaHi badera,
Thank you for your suggestion. We will consider improving the Documentation for future versions of jQWidgets.
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.