jQWidgets Forums
jQuery UI Widgets › Forums › Lists › DropDownList › ddl on tablet
Tagged: DropDownList
This topic contains 5 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 1 month ago.
-
Authorddl on tablet Posts
-
Hi guys,
I have jqx drop down list with checkboxes on my site, everything works great until I run it on android tablet or smartphone. Seems to me that
$(“#ddlyears”).jqxDropDownList(‘getSelectedIndex’); is always returning -1 (even if multiple checkboxes inside ddl are checked) on tablet devices so my jqxvalidator is crashing. I repeat, everything works fine on desktop and laptop…
Thanks a lot for your help!Hi atomic,
getSelectedIndex will return -1 when you run it on PC as well, because Check is not the same as Select, right. For geting the checked items, use the getCheckedItems method. Ex: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdropdownlist/checkboxes.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks Peter.
I see your point, but this code works perfectly well on PC…$("#ddlyears").jqxDropDownList({ source: ddlYears, theme: theme, selectedIndex: -1, width: '260px', height: '25px', promptText: please_select_years, checkboxes: true }); $("#Submit").jqxButton({ width: '150', height: '25',theme: theme}); $('#Submit').on('click', function (event) { event.preventDefault(); $('#case').jqxValidator('validate'); }); $('#case').jqxValidator({ rules: [ { input: "#ddlyears", message: select_one_year, action: 'blur', rule: function (input, commit) { var index = $("#ddlyears").jqxDropDownList('getSelectedIndex'); return index != -1; return 1; } } ] });
Hi atomic,
The SelectedIndex is not related to the CheckBoxes in the DropDownList. If you wish, use the correct approach which I suggested you.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comYeah I did and it works now on tablet as well,but I just wanted to report to you that it is actually working on PC with SelectedIndex…???
Thanks a lot for your help!Hi atomic,
selectedIndex is for getting or setting the selected Index. There is no selection when Checkboxes are enabled so the selectedIndex should never be used in that case. Also note that in Checkboxes mode you get an Array of Checked Items, not a single index. The single selection index is for single selection mode without checkboxes.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.