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

TreeView: onExpand-callback #543

Merged
merged 3 commits into from
Sep 22, 2022
Merged

TreeView: onExpand-callback #543

merged 3 commits into from
Sep 22, 2022

Conversation

robkri
Copy link
Contributor

@robkri robkri commented Sep 21, 2022

This PR adds a global onItemExpandToggle and an item specific onExpandToggle callback function, that can be used to load child items lazily.

This fixes the unexpected behavior of triggering child loading on invoking an item. The loading of children now can be triggered, when the item gets expanded. Then a loading indicator is shown if the loading takes some time. When loading is complete, the loading indicator is removed and the item gets expanded.

Before:
Fluent_UI_TreeView_Lazy_onExpand_in_stateless_parent
The child items get loaded when the item is invoked.

After:
Fluent_UI_TreeView_Lazy_onExpand
Nothing happens when the item gets invoked. Child items get loaded when the item gets expanded.

Related Issue: #522

Pre-launch Checklist

  • [ x ] I have updated CHANGELOG.md with my changes
  • [ x ] I have run "dart format ." on the project
  • [ x ] I have added/updated relevant documentation

… lazy loading

- Add global onItemExpandToggle callback to TreeView.
- Add onExpandToggle callback to TreeViewItem.
-> The global callback gets executed before(!) the item's callback.
- Add documentation.

These callbacks can be used to load child items lazily, which fixes the unexpected behavior of triggering
child loading on invoking an item. The loading of children now can be triggered, when the item gets expanded. Then a loading indicator is shown if the loading takes some time. When loading is complete, the loading indicator is removed and the item gets expanded.
Copy link
Owner

@bdlukaa bdlukaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example app should also be updated to match the new behavior!

Showcase example for lazy loading tree view items updated to the new behavior.
@bdlukaa bdlukaa merged commit 12eddd2 into bdlukaa:master Sep 22, 2022
@robkri robkri deleted the expandlistener branch December 1, 2022 16:05
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

Successfully merging this pull request may close these issues.

None yet

2 participants