I can't get selectable lists to work. After failing to work it out in my own project, I've tried the example straight out of the manual -- the one that looks like this:
getInitialState() {
return { selectedIndex: 1 };
},
handleUpdateSelectedIndex(e,index) {
this.setState({
selectedIndex: index,
});
}
...
let valueLink = {
value: this.state.selectedIndex,
requestChange: this.handleUpdateSelectedIndex
}
...
<SelectableList valueLink={valueLink}>
<ListItem
value={...}
primaryText="..."/>
...
</SelectableList>
A couple observations:
- The
handleUpdateSelectedIndex isn't getting fired no matter what. So no highlights.
- The
ListItems must be the direct children of the SelectableList for it to even highlight the first line upon first render. That means that I can't work out any complex logic inside a map to, let's say, include ListDividers for all but the last ListItem — which needs my map to return the ListItem and ListDivider inside a div per iteration.
Am I missing something?
I can't get selectable lists to work. After failing to work it out in my own project, I've tried the example straight out of the manual -- the one that looks like this:
A couple observations:
handleUpdateSelectedIndexisn't getting fired no matter what. So no highlights.ListItems must be the direct children of theSelectableListfor it to even highlight the first line upon first render. That means that I can't work out any complex logic inside a map to, let's say, includeListDividers for all but the lastListItem— which needs my map to return theListItemandListDividerinside adivper iteration.Am I missing something?