Last active
September 26, 2016 09:53
-
-
Save HemantShukla/ac3f8bbe295d8722272dc97d36b9a8fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
//Global variables | |
$projects:{}, | |
$employees: {}, | |
$manager: {}, | |
doInit : function(cmp) { | |
this.$projects = this.initAutoComplete(cmp, 'projects', ["Project1", "Project2", "Project3"]); | |
this.$employees = this.initAutoComplete(cmp, 'employees', ["Emp1", "Emp2", "Emp3"]); | |
this.$manager = this.initAutoComplete(cmp, 'manager', ["Manager1", "Manager2", "Manager3"]); | |
}, | |
initAutoComplete : function(cmp, eleClass, data) { | |
//Method of Jquery plugin | |
$exampleMulti = $("." + eleClass).select2({ | |
placeholder: "Select a user", | |
data: data, | |
maximumSelectionLength: 4, | |
}); | |
return $exampleMulti; | |
}, | |
save : function(cmp){ | |
//accessing variables values which were set in doInit method w/o passing them. | |
console.log('projects', this.$projects.val()); | |
console.log('emp', this.$employees.val()); | |
console.log('manager', this.$manager.val()); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment