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

Content of Node is not refreshing #9

Open
ynnob opened this issue Jul 28, 2021 · 10 comments
Open

Content of Node is not refreshing #9

ynnob opened this issue Jul 28, 2021 · 10 comments

Comments

@ynnob
Copy link

ynnob commented Jul 28, 2021

Hey,

we use BloC to handle our state of the View. After a navigation event and returning to the view that contains the ListTreeView i reload the Data that is displayed by the ListTreeView.

If i set the treeData() a second time, the itemBuilder of the ListTreeView uses the old data of the initial TreeData() call.

How can i force the ListTreeView to reload the Data so changes are displayed?
In my example i have an item with an int value that is display in the ListTreeView. Inside the itemBuilder i do something like this:

treeViewController.treeData(lChecklistNodeData);
return ListTreeView(
      controller: treeViewController,
      itemBuilder: (BuildContext context, NodeData data) {
        ChecklistNodeData item = data as ChecklistNodeData;

return Text('${item.intValue}');
});

As i said this is working fine the first time, but when i reload the data and the build() method is retriggered the Data in the itemBuilder function is not refreshed. I checked the data i pass to treeData() and it is definitly the new data. But still the itemBuilder uses the data of the first set of treeData().

I managed to refresh the Parent items by resetting the TreeViewController
treeViewController = new TreeViewController();

but this leads to only the parents showing up. All child elements are missing after the second rebuild if i do this.

Thanks in advance

@sooxie
Copy link
Owner

sooxie commented Jul 29, 2021

Ok, I will try the situation you said, please wait a moment.

@sooxie
Copy link
Owner

sooxie commented Aug 1, 2021

Hi buddy, now you can refresh the data with _controller.rebuild(). I'll make it easier to refresh the data and fix it when I have time.

@ynnob
Copy link
Author

ynnob commented Aug 1, 2021

Hi buddy, now you can refresh the data with _controller.rebuild(). I'll make it easier to refresh the data and fix it when I have time.

Thanks for your response! Could you reproduce the issue?
I will give it a try on Monday and I will let you know if it worked.

Thanks

@ynnob
Copy link
Author

ynnob commented Aug 4, 2021

Hi buddy, now you can refresh the data with _controller.rebuild(). I'll make it easier to refresh the data and fix it when I have time.

Hey you did not update the extension. There is no new version.
If i use _controller.rebuild() nothing happens. The Values of the TreeView still do not update.

@dipen-apptrait
Copy link

Hey, have you found any solution for content refreshing?

@lixp185
Copy link
Collaborator

lixp185 commented May 10, 2022 via email

@ynnob
Copy link
Author

ynnob commented May 10, 2022

Hey, have you found any solution for content refreshing?

Nope. Still no solution.

@dipen-apptrait
Copy link

Hey! I got the solution for a content refresh.
_controller!.dispose();
_controller = TreeViewController();
// -- Call function to fetch updated data

setState(() {
_controller!.rebuild();
});

@sooxie
Copy link
Owner

sooxie commented Jun 2, 2022

@Bonnyfication You can use this function

_controller!.rebuild();

@lixp185
Copy link
Collaborator

lixp185 commented Jun 2, 2022 via email

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

4 participants