Skip to content

single and double click event handlers - singleDblClick builds on the dblClick feature #287

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions js/jquery.multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,35 @@

that.activeMouse(that.$selectableUl);
that.activeKeyboard(that.$selectableUl);

if (that.options.singleDblClick) {
that.$selectableUl.on('click', '.ms-elem-selectable', function(){
if (typeof that.options.beforeSelect === 'function') {
that.options.beforeSelect.call(this, $(this).data('ms-value'));
}
});
that.$selectionUl.on('click', '.ms-elem-selection', function(){
if (typeof that.options.beforeDeselect === 'function') {
that.options.beforeDeselect.call(this, $(this).data('ms-value'));
}
});
that.$selectableUl.on('dblclick', '.ms-elem-selectable', function(){
that.select($(this).data('ms-value'));
});
that.$selectionUl.on('dblclick', '.ms-elem-selection', function(){
that.deselect($(this).data('ms-value'));
});
}
else {
var action = that.options.dblClick ? 'dblclick' : 'click';

var action = that.options.dblClick ? 'dblclick' : 'click';

that.$selectableUl.on(action, '.ms-elem-selectable', function(){
that.select($(this).data('ms-value'));
});
that.$selectionUl.on(action, '.ms-elem-selection', function(){
that.deselect($(this).data('ms-value'));
});
that.$selectableUl.on(action, '.ms-elem-selectable', function(){
that.select($(this).data('ms-value'));
});
that.$selectionUl.on(action, '.ms-elem-selection', function(){
that.deselect($(this).data('ms-value'));
});
}

that.activeMouse(that.$selectionUl);
that.activeKeyboard(that.$selectionUl);
Expand Down Expand Up @@ -525,6 +545,7 @@
selectableOptgroup: false,
disabledClass : 'disabled',
dblClick : false,
singleDblClick : false,
keepOrder: false,
cssClass: ''
};
Expand Down