-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
56 lines (53 loc) · 2.31 KB
/
app.js
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
(function() {
return {
events: {
'app.activated' : 'onAppActivated',
'click [data-action-add-html-template]' : 'onAddHtmlTemplate',
'click [data-action-add-hdbs-template]' : 'onAddHdbsTemplate',
'click [data-action-hdbs-select-set]': 'onBtnSetHdbsSelect',
'click [data-action-hdbs-select-get]': 'onBtnGetHdbsSelect',
'click [data-action-html-select-set]': 'onBtnSetHtmlSelect',
'click [data-action-html-select-get]': 'onBtnGetHtmlSelect',
'zd_ui_change .mySelectHtml': 'onHtmlSelectChanged',
'zd_ui_change .mySelectHdbs': 'onHdbsSelectChanged'
},
onAppActivated: function() {
this.options = [
{ value: 'foo', label: 'FOO'},
{ value: 'bar', label: 'BAR'}
];
this.optionSelectedValue = this.options[1].value;
this.switchTo('ticket', {options: this.options}); // will initialize zd-type automatically
},
onAddHtmlTemplate: function() {
this.$('.add-html-template-wrapper').html(this.renderTemplate('_combo_select_html'));
this.$('[data-zd-type]').zdComboSelectMenu(); // need to initialize manually
},
onAddHdbsTemplate: function() {
this.$('.add-hdbs-template-wrapper').html(this.renderTemplate('_combo_select_hdbs', {
options: this.options
}));
this.$('[data-zd-type]').zdComboSelectMenu();
// need to set the selected value manually since helper doesn't support selected option
this.$('.myAddedSelectHdbs > .zd-combo-selectmenu').zdComboSelectMenu('setValue', this.optionSelectedValue);
},
onBtnSetHdbsSelect: function() {
this.$('.mySelectHdbs > .zd-combo-selectmenu').zdComboSelectMenu('setValue', 'bar');
},
onBtnGetHdbsSelect: function() {
console.log('Handlebar select value is ', this.$('.mySelectHdbs > .zd-combo-selectmenu').zdComboSelectMenu('value'));
},
onBtnSetHtmlSelect: function() {
this.$('.mySelectHtml').zdComboSelectMenu('setValue', 'foo');
},
onBtnGetHtmlSelect: function() {
console.log('Html select value ', this.$('.mySelectHtml').zdComboSelectMenu('value'));
},
onHtmlSelectChanged: function(evt, change) {
console.log('Html select change object ', change);
},
onHdbsSelectChanged: function(evt, change) {
console.log('Hdbs select change object ', change);
}
};
}());