Closed roelfsche closed 9 years ago
Duplicate checkboxes aren't handled, and I think that's an application concern anyway - so it doesn't belong in this module. You could easily handle that using something like this:
$('#my-tree').on('change', function(ev) {
$(this).find('[type=checkbox]').map(function() {
if (this.value == ev.target.value) $(this).checked(ev.target.checked);
});
});
Actually, I tell a lie - duplicates are handled! One sec...
Are you using the handleDuplicateCheckboxes
option?
I pushed an update today and this appears to be working for me. Can you confirm whether your issue is resolved?
Hey Simon, I will try it next week. Rolf
Am 21.10.2014 um 05:15 schrieb Simon Wade notifications@github.com:
I pushed an update today and this appears to be working for me. Can you confirm whether your issue is resolved?
— Reply to this email directly or view it on GitHub.
Hey Simon, tried it but still don't work. After debugging a bit i think it doesn't depends on Bonsai but on Qubit. In Qubit.process() all children gets checked via self.setChecked() in line 26. I think in 'setChecked()' you need to check, if there are other checkboxes (without this checkbox) in the scope and check them manually (so the 'change' event doesn't fire, otherwise handleDuplicates() checks this checkbox again and it will end up in an infinite loop). should be quite equal to 'handleDuplicates()' in bonsai without triggering the 'change'-event.
Thanks @roelfsche, the handleDuplicates()
method keeps track of the IDs that it's already done in order to avoid an infinite loop. Would it be possible for you to provide me with an example so I can debug it?
Hey Simon, If you want to debug, please goto: http://ttt.lumturo.net/user/login http://ttt.lumturo.net/user/login
htaccess-credentials: user: simon pass: nomis
application-credentials: user: simon pass: simon
please navigate manually to http://ttt.lumturo.net/admin/permission/edit http://ttt.lumturo.net/admin/permission/edit
there you can find an expanded bonsai list. if you check the second last ‚Labor 3-2‘-Entry, everything works as expected. but if you check the parent checkbox ‚Laborbereich 4‘, the second ‚Labor 3-2‘-Entry (child of ‚Laborbereich 3‘) will not be checked. the problem seems to be, that qubit checks the checkboxes via $.fn.prop(...) which doesn’t fire the ‚change‘ event. otherwise if ‚change‘ would be fired it ends up in an invinite loop (i tried to trigger the change-event).
Am 27.10.2014 um 22:26 schrieb Simon Wade notifications@github.com:
Thanks @roelfsche https://github.com/roelfsche, the handleDuplicates() method keeps track of the IDs that it's already done in order to avoid an infinite loop. Would it be possible for you to provide me with an example so I can debug it?
— Reply to this email directly or view it on GitHub https://github.com/aexmachina/jquery-bonsai/issues/7#issuecomment-60672363.
l u m t u r o Softwareentwicklung & Schulungen Dipl. Inf. Rolf Staege Blücherstr. 75 18055 Rostock
Fon: 0381 / 210 45 83 Mobil: 0176 / 49 139 150 Fax: 0381 / 210 45 83
Email: rolf.staege@lumturo.net Internet: http://www.lumturo.net
Hey @roelfsche, I've pushed v1.0.4 which should fix your issue. Thanks for the report.
Hey @aexmachina ,
tried it locally and as far as i can see it still doesn't work.
Did you check 'Labor 3' in my example (see in the attachment)?
The lower 'Labor 3-2' still stays unchecked as well as it's parent 'Labor 4'.
roelfsche
Hey there. I've done a big refactor of jquery-qubit and it's much better now, so thanks for your help. Version 2.0.0 has been pushed, please let me know if it resolves your issue.
@aexmachina, Now it works perfectly. Great work! roelfsche
@aexmachina found another small issue (hope, you doesn't become annoyed..). now, if i check and uncheck a parent of my duplicate checkboxes (i.e. 'Laborbereich 3' in my example), the parent node = root-node stays in intermediate state (see attachment).
Great, not at all. Thanks for helping me get the bugs out. I'd really like to have tests for this, but don't have time right now.
I've pushed a fix for that issue.
Hi, if a sub checkbox becomes checked because a parent checkbox is checked by user, a possible duplicate checkbox of that sub checkbox doesn't becomes checked.