jQuery UI Widgets Forums Lists ListBox Select all and items on checkbox click

This topic contains 3 replies, has 2 voices, and was last updated by  Hristo 6 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Select all and items on checkbox click #81635

    zakstev
    Participant

    hi,

    How to select all items on check box click and unselect all items on uncheck check box.

      Requirement:


    If checkbox=True than select all listbox items
    else unselect all listbox items

    $(“#SelectAllCompanies”).on(‘change’, function (event) {
    var checked = $(‘#SelectAllCompanies’).jqxCheckBox(‘checked’);
    if(checked){
    var items = $(“#CompaniesList”).jqxListBox(‘getSelectedItems’);
    for (var i = 0; i < items.length; i++) {
    $(“#CompaniesList”).jqxListBox(‘selectIndex’, i);
    }
    }
    else{
    for (var i = 0; i < items.length; i++) {
    $(“#CompaniesList”).jqxListBox(‘unselectIndex’, i);
    }
    }
    });

    Thanks in advance…

    Select all and items on checkbox click #81663

    Hristo
    Participant

    Hello zakstev,

    Try to use checkChange event and getSelectedItems method.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    • This reply was modified 6 years, 7 months ago by  Hristo.
    • This reply was modified 6 years, 7 months ago by  Hristo.
    • This reply was modified 6 years, 7 months ago by  Hristo.
    Select all and items on checkbox click #81877

    zakstev
    Participant

    hi,

    checkChange event is not working, please check.

    $(“#SelectAllCompanies”).on(‘checkChange’, function (event) {
    alert(“Test”);
    });

    Thanks…

    Regards,
    MZ

    Select all and items on checkbox click #81913

    Hristo
    Participant

    Hello zakstev,

    Please take a look this example:
    http://jsfiddle.net/txhi/t54xfo48/

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.