Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-processing hook or event? #27

Open
deenfoxx opened this issue Jun 1, 2016 · 0 comments
Open

Pre-processing hook or event? #27

deenfoxx opened this issue Jun 1, 2016 · 0 comments

Comments

@deenfoxx
Copy link

deenfoxx commented Jun 1, 2016

Thank you for the lightweight solution for trees... jsTree was just way too bloated for what we need.

However, is there an easy way to hook when a node is clicked? I DID make it work, by hard-coding the following into qubit, but is there a better way? The following is what I am currently doing:

At line 10, in the "Qubit" constructor, after "this.scope = $(el);"...

// Required to keep track of the key-state since key state is not sent to "change" event.
this.multiple = false;
$(document.body).on('keyup keydown', function(e) {
    self.multiple = e.shiftKey || e.ctrlKey || e.altKey || e.metaKey;
});

At (what was originally) line 30, in the "process" method/function, after "this.suspendListeners = true;"...

// If it is not a multiple and we checked the box, clear all checkboxes, then put back this check.
if (!self.multiple && checkbox.prop('checked')) {
    this.scope.find('input[type=checkbox]').each(function() {
        self.setChecked($(this), false);
    });
    self.setChecked(checkbox, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant