-
Notifications
You must be signed in to change notification settings - Fork 885
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
How to make a TreeView node expandable without it actually having any children? #29
Comments
The new TreeView checks your implementation of the TreeItem.ChildCount method to determine if the item is expandable. Depending on how you populate your model, it may be necessary to notify the TreeView about new items by calling TreeModelBase.PublishItemsReset (if you embed TreeModelBase in your model), or publish the event yourself and pass the parent item (or nil if roots are to be reset) as parameter. TreeModel has a LazyPopulation method, that controls how a TreeView populates its internal items. So far I have only tested the lazy case. Maybe the eager case (default with TreeModelBase) isn't working yet. Anyway, see the filebrowser example for how it can be done. |
Whoops, just noticed you asked how it can be done without having children. I guess that isn't supported with the new TreeView. If your motivation for doing this is lazy initialization, my first reply should help. |
Well, I was using the dummy child to handle this problem. Your comment are very useful, thank you! |
After item.children appended new contents, I've tried I found only
|
Ok, so you just want lazy initialization. You should do the same as the filebrowser example:
The TreeView then should take care of everything else and only ever ask for one level of items if you expand an item. Of course the crash problem should be fixed anyway. Thanks for your feedback! |
Yes, I've tried lazy initialization following the filebrowser example, Just as Step 2 and 3 required. But it's obviously an synchronous process when creating of the child items and returning the item count in the My situation demanding an asynchronous population of the child items, which regards the item expanding click as a trigger to fetch all the content from a remote server. But my communication with the server is asynchronous so i Well, i have't found a solution yet. Any suggestion? |
Please try again with the latest changes. |
Well, thank you! Your works are really appreciated! |
In the old treeview implementation, i found it's easy to make a expandable treeview item,
But now how can i do that?
The text was updated successfully, but these errors were encountered: