jQWidgets Forums

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts

  • aocc
    Member

    Thanks for your response, Peter. Sadly I need two checkboxes (otherwise trust me, I would take advantage of the built ones). I do like the drag and drop functionality, however. Is the drag and drop widget capable of handling elements with dynamic states, or could I expect similar issues?


    aocc
    Member
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <link href="../jqwidgets/jqwidgets/styles/jqx.base.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="../jqwidgets/scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="../jqwidgets/jqwidgets/jqx-all.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    var exampleSource = [
    'Item_1',
    'Item_2',
    'Item_3'
    ];
    $("#jqxListBox").jqxListBox({
    source: exampleSource,
    width: 250,
    height: 400,
    allowDrag: true,
    allowDrop: true,
    renderer: function (index, label, value) {
    var table = '<table><tr><td>' + label + '</td><td><input id="' + label + '_check1" type="checkbox"';
    if (globalCheckboxes[label].check1)
    table = table + ' checked="checked"';
    table = table + ' onclick="onclick1(\'' + label + '\')"/></td><td><input id="' + label + '_check2" type="checkbox"'
    if (globalCheckboxes[label].check2)
    table = table + ' checked="checked"';
    table = table + ' onclick="onclick2(\'' + label + '\')"/></td></tr></table>';
    return table;
    }
    });
    });
    var globalCheckboxes = {Item_1: {check1: true, check2: true},
    Item_2: {check1: true, check2: false},
    Item_3: {check1: false, check2: false}
    };
    function onclick1(label) {
    globalCheckboxes[label].check1 = !globalCheckboxes[label].check1;
    }
    function onclick2(label) {
    globalCheckboxes[label].check2 = !globalCheckboxes[label].check2;
    }
    </script>
    </head>
    <body>
    <div id="jqxListBox">
    </div>
    </body>
    </html>

    aocc
    Member

    Sorry, looks like it got cut off. I have attached the script for the example below.

    Problem is in IE 7 when you click on a checkbox, and then click on another listbox item, the state of the first checkbox reverts to what it was before.

    $(document).ready(function() {
    var exampleSource = [
    ‘Item_1’,
    ‘Item_2’,
    ‘Item_3’
    ];

    $(“#jqxListBox”).jqxListBox({
    source: exampleSource,
    width: 250,
    height: 400,
    allowDrag: true,
    allowDrop: true,
    renderer: function (index, label, value) {
    var table = ” + label +


    ‘;
    return table;

    });
    var globalCheckboxes = {Item_1: {check1: true, check2: true},
    Item_2: {check1: true, check2: false},
    Item_3: {check1: false, check2: false}
    };
    function onclick1(label) {
    globalCheckboxes[label].check1 = !globalCheckboxes[label].check1;
    }
    function onclick2(label) {
    globalCheckboxes[label].check2 = !globalCheckboxes[label].check2;
    }

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