Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onMove index always = 0 #258

Open
deniznet opened this issue Jul 14, 2024 · 1 comment
Open

onMove index always = 0 #258

deniznet opened this issue Jul 14, 2024 · 1 comment

Comments

@deniznet
Copy link

deniznet commented Jul 14, 2024

Hi! First of all, thanks for this library, it's cool! I try to make managment tree with data={data}, add onMove handler, but when ever it run - index alway has value 0. Why? And how to manage Move and Reorder by DragNDrop programmisticly?

onMove={(e) => {
   console.log('onMove ', e);
}}

in devTool:

onMove {dragIds: Array(1), parentId: '5184', index: 0, dragNodes: Array(1), parentNode: _NodeApi}dragIds: ['5183']dragNodes: [_NodeApi]index: 0parentId: "5184"parentNode: _NodeApi {tree: _TreeApi, id: '5184', data: {…}, level: 3, handleClick: ƒ, …}[[Prototype]]: Object

@deniznet
Copy link
Author

Oo! It's incredible! I'v found solution! When openByDefault = true then onMove take index=0 always. But if I toggle to openByDefault=false, so onMove work perfectly! Why?

<Tree
        data={data}
        openByDefault={false} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant