You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [react-filtered-multiselect.min.js](https://npmcdn.com/react-filtered-multiselect/umd/react-filtered-multiselect.min.js) (compressed production version)
*[react-filtered-multiselect.min.js](https://unpkg.com/react-filtered-multiselect/umd/react-filtered-multiselect.min.js) (compressed production version)
53
52
54
53
## API
55
54
56
55
### Required props
57
56
58
57
Minimal usage:
59
58
60
-
```javascript
61
-
var options = [
59
+
```js
60
+
let options = [
62
61
{value:1, text:'Item One'},
63
62
{value:2, text:'Item Two'}
64
63
]
@@ -71,7 +70,7 @@ var options = [
71
70
72
71
`options` - list of objects providing `<option>` data for the multi-select. By default, these should have ``text`` and ``value`` properties, but this is configurable via props.
73
72
74
-
The component will update its display if its `options` list changes length or is replaced with a different list, but it will *not* be able to detect changes which don't affect length or object equality, such as replacement of one option with another. Consider using `react-addons-update` or other immutability helpers if you need to do this.
73
+
The component will update its display if its `options` list changes length or is replaced with a different list, but it will *not* be able to detect changes which don't affect length or object equality, such as replacement of one option with another. Consider using [immutability-helper](https://github.com/kolodny/immutability-helper) or other immutability libraries if you need to do this.
75
74
76
75
`onChange(selectedOptions)` - callback which will be called with selected option objects each time the selection is added to.
77
76
@@ -102,7 +101,7 @@ the `value` for its `<option>`.
102
101
103
102
### Default props
104
103
105
-
```javascript
104
+
```js
106
105
{
107
106
buttonText:'Select',
108
107
className:'FilteredMultiSelect',
@@ -127,28 +126,27 @@ the `value` for its `<option>`.
127
126
128
127
Example which implements display of selected items and de-selection.
129
128
130
-
```javascript
131
-
var CULTURE_SHIPS = [
129
+
```js
130
+
constCULTURE_SHIPS= [
132
131
{id:1, name:'5*Gelish-Oplule'},
133
132
{id:2, name:'7*Uagren'},
134
133
// ...
135
134
{id:249, name:'Zero Gravitas'},
136
135
{id:250, name:'Zoologist'}
137
136
]
138
137
139
-
var Example = React.createClass({
140
-
getInitialState() {
141
-
return {selectedShips: []}
142
-
},
138
+
classExampleextendsReact.Component {
139
+
state = {selectedShips: []}
143
140
144
141
handleDeselect(index) {
145
142
var selectedShips =this.state.selectedShips.slice()
146
143
selectedShips.splice(index, 1)
147
144
this.setState({selectedShips})
148
-
},
149
-
handleSelectionChange(selectedShips) {
145
+
}
146
+
147
+
handleSelectionChange= (selectedShips) => {
150
148
this.setState({selectedShips})
151
-
},
149
+
}
152
150
153
151
render() {
154
152
var {selectedShips} =this.state
@@ -164,22 +162,19 @@ var Example = React.createClass({
0 commit comments