Skip to content

Is there a way to make ItemComponent active and its parent nodes open at the same time ? #195

@kk798

Description

@kk798

Hi @iannbing, First of all, Thanks for the wonderful library which helped me a lot.
But I am facing lil issue with the openNodes prop. let me show you the code.
`


Hello CodeSandbox


Start editing to see some magic happen!


<TreeMenu
openNodes={["mammal","canidae"]}
activeKey="mammal/canidae/dog"
data={dataInArray}
>
{({ search, items }) => {
return (
<>
<input onChange={(e) => search(e.target.value)} />

    {items.map((props) => {
    const childrenProps = {
    ...props,
    onClick: () => window.open(props.url)
    // style: { color: props.color || "black" }
    };

                  return <ItemComponent {...childrenProps} />;
                })}
              </ul>
            </>
          );
        }}
      </TreeMenu>
    </div>`
    

    Here, I tried to open all the parent nodes till their children, but it is just opening the first parent let's say mammal. also, I m unable to expand(also click) the rest of the parents till dog.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions