forked from olton/metroui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect.js
More file actions
62 lines (47 loc) · 1.41 KB
/
select.js
File metadata and controls
62 lines (47 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(function ( $ ) {
"use strict";
$.widget( "metro.select" , {
version: "3.0.0",
options: {
},
_create: function () {
var that = this, element = this.element, o = this.options;
var func_options = [
'templateResult',
'templateSelection',
'matcher',
'initSelection',
'query'
];
$.each(element.data(), function(key, value){
try {
o[key] = $.parseJSON(value);
} catch (e) {
o[key] = value;
}
});
func_options.map(function(func, index){
if (o[func] !== undefined) {
o[func] = window[o[func]];
}
});
if (o.dropdownParent !== undefined) {
o.dropdownParent = $(o.dropdownParent);
}
if(jQuery().select2) {
try {
element.find("select").select2(o);
} catch (e) {
}
} else {
alert('Select2 plugin required');
}
element.data('select', this);
},
_destroy: function () {
},
_setOption: function ( key, value ) {
this._super('_setOption', key, value);
}
});
})( jQuery );