1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.widget.Select");
|
|
|
14 |
dojo.require("dojo.widget.ComboBox");
|
|
|
15 |
dojo.require("dojo.widget.*");
|
|
|
16 |
dojo.require("dojo.widget.html.stabile");
|
|
|
17 |
dojo.widget.defineWidget("dojo.widget.Select", dojo.widget.ComboBox, {forceValidOption:true, setValue:function (value) {
|
|
|
18 |
this.comboBoxValue.value = value;
|
|
|
19 |
dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true);
|
|
|
20 |
this.onValueChanged(value);
|
|
|
21 |
}, setLabel:function (value) {
|
|
|
22 |
this.comboBoxSelectionValue.value = value;
|
|
|
23 |
if (this.textInputNode.value != value) {
|
|
|
24 |
this.textInputNode.value = value;
|
|
|
25 |
}
|
|
|
26 |
}, getLabel:function () {
|
|
|
27 |
return this.comboBoxSelectionValue.value;
|
|
|
28 |
}, getState:function () {
|
|
|
29 |
return {value:this.getValue(), label:this.getLabel()};
|
|
|
30 |
}, onKeyUp:function (evt) {
|
|
|
31 |
this.setLabel(this.textInputNode.value);
|
|
|
32 |
}, setState:function (state) {
|
|
|
33 |
this.setValue(state.value);
|
|
|
34 |
this.setLabel(state.label);
|
|
|
35 |
}, setAllValues:function (value1, value2) {
|
|
|
36 |
this.setLabel(value1);
|
|
|
37 |
this.setValue(value2);
|
|
|
38 |
}});
|
|
|
39 |
|