react-multilevel-dropdown
react-multilevel-dropdown copied to clipboard
Clicking on child item within sub-menu triggers parent's callback
<Dropdown title='Dropdown title' position="right">
{Object.keys(_g_lineage_tree).map(parent_lh=>
<Dropdown.Item position="right" key={parent_lh} onClick={(e)=>console.log(parent_lh)}>
{parent_lh}
<Dropdown.Submenu position="right">
{_g_lineage_tree[parent_lh].map(child_lh=>
<Dropdown.Item position="right" key={child_lh} onClick={(e)=>console.log(child_lh)}>
{child_lh}
</Dropdown.Item>
)}
</Dropdown.Submenu>
</Dropdown.Item>
)}
</Dropdown>
_g_lineage_tree
is a JSON object containing the menu and sub-menu names.
When I click on a sub-menu item it triggers the menu (parent) callback.