Prevent 'Folders / Groups' from being selected
Nevario opened this issue · 2 comments
Hi, I ran into the same issue as yourself.
As a workaround I did the following:
On the select2totree.js file locate the following code.
if ($(container).hasClass("non-leaf")) { return $.merge($('<span class="expand-collapse" onmouseup="expColMouseupHandler(event);"></span>'), $iteme); }
This code is responsible for joining together the label and the expand/collapse button. Notice that the expand/collapse button has an 'onmouseup' event that prevents default events from firing. What we want to do is create our own label which has this onmouseup event.
It should look something like the following:
if ($(container).hasClass("non-leaf")) { var $itemf = $("<span class='item-label' onmouseup='expColMouseupHandler(event)'></span>").append(label); return $.merge($('<span class="expand-collapse" onmouseup="expColMouseupHandler(event);"></span>'), $itemf); }
Hope that helps.
Hi @EarlMurray ,
A massive thank-you for taking the time to detail your solution to this issue.
I just tested and it works perfectly! Can't thank you enough!
Thanks,
Tim