Skip to content

[DropDownMenu] not sending menu item value #5708

@yanickrochon

Description

@yanickrochon

I need to generate a DropDownMenu dynamically, and some of the options (menu items) are grouped with a Divider and a Subheader. Kinda like

<DropDownMenu value={ current } onChange={ this.handleChange }>
  { groups.map(group => (
    <div key={ group.name }>
      <Divider />
      <Subheader>{ group.name }</Subheader>
      { group.options.map(option => (
        <MenuItem key={ option.key } value={ option.value } primaryText={ option.label } />
      )) }
    </div>
  )) }
</DropDownMenu>

Unfortunately, the handleChange handler only receives two arguments; the event object and an index. The value is always undefined, even if manually specified (i.e. therefore, it is not that option.value = "undefined";). I suspect it may have something to do with the <div> element in there; I'd have to actually read the code 😛

In any case, this is an issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: menuChanges related to the menu.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions