File tree Expand file tree Collapse file tree 3 files changed +49
-8
lines changed Expand file tree Collapse file tree 3 files changed +49
-8
lines changed Original file line number Diff line number Diff line change
1
+ # Dropdown
2
+
3
+
4
+ ```
5
+ var DropDown = require('react-toolbox/components/dropdown');
6
+
7
+ var data = [
8
+ { '1': 'Never' },
9
+ { '2': 'Every Night' },
10
+ { '3': 'Weeknights' },
11
+ { '4': 'Weekends' },
12
+ { '5': 'Weekly' },
13
+ ];
14
+
15
+ <DropDown dataSource={data} value='2' />
16
+ ```
17
+
18
+ ## Properties
19
+
20
+ | Name | Type | Default | Description |
21
+ | :- | :-: | :- | :-|
22
+ | ** type** | String | "normal" | Type of the component, overwrite this property if you need set a different stylesheet.
23
+ | ** className** | String | | Set the class-styles of the Component.
24
+ | ** dataSource** | Object | | JSON data representing all items in the dropdown.
25
+ | ** value** | String | | Default value using JSON data.
26
+ | ** label** | String | | The text string to use for the floating label element.
27
+ | ** disabled** | Boolean | false | Set components disabled.
28
+ | ** onChange** | Function | | Callback function that is fired when the components's value changes.
29
+
30
+ ## Methods
31
+
32
+ #### getValue
33
+ Returns the value of the input.
34
+
35
+ ```
36
+ dropdown_instance.getValue();
37
+ ```
38
+
39
+ #### setValue
40
+ Sets the value of the input element.
41
+
42
+ ```
43
+ dropdown_instance.setValue(newValue);
44
+ ```
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ module.exports = React.createClass
18
18
value : React .PropTypes .string
19
19
label : React .PropTypes .string
20
20
disabled : React .PropTypes .disabled
21
+ onChange : React .PropTypes .func
21
22
22
23
getDefaultProps : ->
23
24
type : " normal"
@@ -42,9 +43,10 @@ module.exports = React.createClass
42
43
active : false
43
44
value : target .getAttribute " id"
44
45
ripple :
45
- left : event .pageX - client ? .left
46
- top : event .pageY - client ? .top
47
- width : (client ? .width * 2 )
46
+ left : event .pageX - client ? .left
47
+ top : event .pageY - client ? .top
48
+ width : (client ? .width * 2 )
49
+ @props .onChange event, @
48
50
49
51
# -- Render
50
52
render : ->
Original file line number Diff line number Diff line change @@ -16,11 +16,6 @@ module.exports = React.createClass
16
16
" EN-en" : " USA"
17
17
" FR-fr" : " France"
18
18
19
- # -- Events
20
- onAutocompleteValues : (ref , method ) ->
21
- console .log @refs .autocomplete_multiple .getValue ()
22
- console .log @refs .autocomplete_simple .getValue ()
23
-
24
19
# -- Render
25
20
render : ->
26
21
countries_selected = [" USA" , " Tongo" ]
You can’t perform that action at this time.
0 commit comments