-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MudTreeViewItem: Add 'BodyContent' which renders instead of text, end text and end icon. #3831
Conversation
This doesn't build and would need tests for the new API added. But before you spend more time on this we would need to see what the new API brings. @tungi52 |
Interesting with a new API in sight. I use this in my project, with "MudTreeView" renamed to "MudTreeView1". The compile error was one of the "MudTreeView1" left over. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #3831 +/- ##
==========================================
- Coverage 91.37% 91.37% -0.01%
==========================================
Files 397 397
Lines 14919 14929 +10
==========================================
+ Hits 13632 13641 +9
- Misses 1287 1288 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
The new |
I know this is still in discussion but |
I just wanted to make that change, but realised that |
Thanks! For me this is ok. Can you add test(s) and an example to demonstrate the new features? |
I will look at that. |
@rpc-scandinavia This doesn't build for me. |
src/MudBlazor.UnitTests.Viewer/TestComponents/TreeView/TreeViewTest3.razor
Outdated
Show resolved
Hide resolved
I didn't see this PR when I was creating this isssue #4503 but it looks like this changes should also solve the problems described in the ticket. I will leave the ticket open tho, until this is merged. |
Anything else stopping this PR to get accepted and merged? I also need a way to use ServerData with custom MudTreeViewItem content. This PR would solve that issue. |
I'm sorry that it took as so long to get back. @rpc-scandinavia, is there still life in this PR? Can we resurrect it? |
Well, everything worked, the only thing missing was the test - and I don't know how to make the test I want. Anyway, there has been so many changes at your end, that I can't get my GitHub copy to work - which probably mean that I have to delete my copy, fork it again, make all the changes again, and create a new pull request. So much hazzle for around 10 lines of code. I have been using my solution since the first post, and I think we ended up with something good. There was however this question:
I only want to spend more time on this GitHub pull, if you put it into the project. |
Deleted my fork, and forked the project again. |
Ok @henon, I corrected the spelling errors and added some simple tests. |
@henon, another thing in
With:
Because of:
Do you think that should be done in this PR ? |
I wonder if it's possible to test the new Reload method that was introduced.
Can you be more specific where, there are many of them FYI: I think github it dead and you can't push rn. |
Not related to this PR, but why is foeach (var item in _childItems){
await item.SelectItem(value, source)
} I recommend to avoid async void unless totally necessary i.e. in event handler, for example. I kinda want to propose to make Reload ->ReloadAsync with an Task since MudTree has async semantics. the |
Yes and of course the ReloadAsync function can also be tested easily. I.e. by changin the server data before calling it and checking that the changed data is reflected in the tree. |
Only if you are sure it is necessary. The first question to ask is why were they called from the wrong thread. What caused this? |
It's only my guess, but maybe he modified some state in a test, like changing value of [parameter] property. |
I saw that as well, I am working on another PR where I call And my |
Ok, but lets keep it as is in this PR. Please, change
And then I guess we are good to go and merge this PR. |
} | ||
else if (MudTreeRoot != null) | ||
{ | ||
MudTreeRoot.CallStateHasChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you rebase to latest changes there is new interface now and you can do something like this
((IMudStateHasChanged)MudTreeRoot).StateHasChanged()
and remove the CallStateHasChanged
@ScarletKuro, I have made the |
lgtm |
Thanks for your contribution @rpc-scandinavia ! |
… text and end icon. (MudBlazor#3831) MudTreeViewItem: Added 'BodyContent' which renders instead of text, end text and end icon.
… text and end icon. (MudBlazor#3831) MudTreeViewItem: Added 'BodyContent' which renders instead of text, end text and end icon.
Description
The 'Content' render fragment replaces the entire tree view item, which mean that you have to handle the toggle button and logic your self.
I needed to use the nice logic of the tree view (loading, expanding/collapsing etc.), but provide a custom body.
I also needed a way to reload the tree view item.
How Has This Been Tested?
Uses it in mu project.
Types of changes
Checklist:
dev
).