Skip to content

Commit a49bb7b

Browse files
committed
Add AfterInit event
1 parent f304e24 commit a49bb7b

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/node_modules
22
.htaccess
3+
.idea

dist/js/multiselect.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ if (typeof jQuery === 'undefined') {
148148

149149
// Initialize events
150150
self.events();
151+
152+
if ( typeof self.callbacks.afterInit == 'function' && !silent ) {
153+
self.callbacks.afterInit();
154+
}
151155
},
152156

153157
events: function() {
@@ -223,7 +227,7 @@ if (typeof jQuery === 'undefined') {
223227
self.$left.on('keypress', function(e) {
224228
if (e.keyCode === 13) {
225229
e.preventDefault();
226-
230+
227231
var $options = self.$left.find('option:selected');
228232

229233
if ( $options.length ) {
@@ -445,7 +449,7 @@ if (typeof jQuery === 'undefined') {
445449
if (!$destinationGroup.length) {
446450
$destinationGroup = $sourceGroup.clone(true);
447451
$destinationGroup.empty();
448-
452+
449453
$destination.move($destinationGroup);
450454
}
451455

@@ -559,6 +563,15 @@ if (typeof jQuery === 'undefined') {
559563
});
560564
},
561565

566+
/** will be executed after initialize plugin
567+
*
568+
* @method afterInit
569+
*
570+
* @default true
571+
* @return {boolean}
572+
**/
573+
afterInit: function(){ return true; },
574+
562575
/** will be executed each time before moving option[s] to right
563576
*
564577
* IMPORTANT : this method must return boolean value

0 commit comments

Comments
 (0)