Select one item

Posted by: darkthanhtam on 3 September 2020, 1:17 am EST

  • Posted 3 September 2020, 1:17 am EST

    I have a example like this
    https://jsfiddle.net/LaAsCE/o12eu80x/
    and I want to select just one item at time but not all item inside it like this picture. Can you help?
  • Replied 4 September 2020, 12:06 am EST

    Hi,

    You may override the setChecked method of the TreeNode as follows to achieve the required functionality:
    var oldFn = wijmo.nav.TreeNode.prototype.setChecked;
    wijmo.nav.TreeNode.prototype.setChecked = function(checked) {
    let cb = this.checkBox;
    cb.checked = checked;
    cb.indeterminate = false;
    }

    You may also refer to the following sample which demonstrates the same:
    https://jsfiddle.net/kjptc5w9/1/

    Regards
  • Replied 4 September 2020, 4:34 am EST

    Hi,

    Thanks, that's great.

    But I have problem that I have used formatItem to insert a select list beside the item but I want to set align it to right.



    And another thing that when I select the select list it just close right after that.

    Can you help with that?
    https://jsfiddle.net/LaAsCE/z3791yxe/

    Regards~
  • Marked as Answer

    Replied 7 September 2020, 5:27 am EST

    Thank you for providing the sample.
    To right-align the select, you may set it float CSS to right.
    .wj-node select{
    float: right;
    }

    To prevent the select from autoclosing, you may handle the click event and call prevent default. Please refer to the following updated sample and let us know if you face any issues:
    https://jsfiddle.net/w5Lqdgks/
  • Replied 15 September 2020, 6:23 pm EST

    Thanks,
    That helps a lot.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels