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

PdTree: A parent item with key '1' could not be found #13

Open
elylv opened this issue Nov 16, 2020 · 2 comments
Open

PdTree: A parent item with key '1' could not be found #13

elylv opened this issue Nov 16, 2020 · 2 comments

Comments

@elylv
Copy link

elylv commented Nov 16, 2020

I am trying to create a treeview from a self-referential table, with a format like:

Id  Name     ParentId
1   Item1     null
2   Item2     null
3   Item1.1   1
4   Item1.2   1

However, when I try to use this data, I get an error that "A parent item with key '1' could not be found". I am debugging and intercepting the data being returned in the GetDataAsync procedure, and can confirm that each item has a matching ParentId (or null).

It looks like the parent items have to appear before any child items in the list? This is pretty awkward, especially if we are going to be rearranging items within the tree.

Is there example code of how we're supposed to bind to this type of data. The file explorer demo is cool, but a good example of binding to a self-referential table with int keys would be more useful.

@elylv
Copy link
Author

elylv commented Nov 16, 2020

Update: The code runs after sorting by ID, to ensure nothing references a parent which is later in the list, however, it only shows the parent items in the list on the page, with nothing happening when I click on them (and inspecting the HTML, it doesn't seem to be set to actually try and do anything when the nodes are clicked).

@MarkGoldring
Copy link
Collaborator

Are you loading each node as its expanded? If so please ensure LoadOnDemand is set to true. The latest library has seen some work to the PDTree component to allow greater drag and drop support. There are also now 3 demo pages for the component and the second demonstrates load on demand functionality.

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

2 participants