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.
I need to generate a
DropDownMenudynamically, and some of the options (menu items) are grouped with aDividerand aSubheader. Kinda likeUnfortunately, the
handleChangehandler only receives two arguments; theeventobject and anindex. Thevalueis alwaysundefined, even if manually specified (i.e. therefore, it is not thatoption.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.