Skip to content

SelectableList not working #2347

@prashaantt

Description

@prashaantt

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:

  1. The handleUpdateSelectedIndex isn't getting fired no matter what. So no highlights.
  2. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: listChanges related to the listscope: selectChanges related to the select.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions