jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList ddl on tablet

Tagged: 

This topic contains 5 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • ddl on tablet #55403

    atomic
    Participant

    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!

    ddl on tablet #55408

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    ddl on tablet #55416

    atomic
    Participant

    Thanks 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;
                                }
                            }
                    ]
                   
            });
    ddl on tablet #55420

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    ddl on tablet #55425

    atomic
    Participant

    Yeah 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!

    ddl on tablet #55426

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.