Pakfile Explorer Searching #57
Labels
Size: Medium
Something that may take a few days or so to implement.
Type: Enhancement
This can improve a system/thing already in place.
Add a text box to the top bar of the pakfile explorer page to filter displayed items.
This is probably quite challenging. As far as I can tell, TreeDataGrid doesn't have a specific property for whether a node should be displayed or not; it just displays item in a list of a node's children (you provide an accessor function
lumper/src/Lumper.UI/ViewModels/Pages/PakfileExplorer/PakfileExplorerViewModel.cs
Lines 56 to 71 in f68c05b
So when the search changes, every node in the tree needs to determine which of it's children to display.
Probably the best way to do this is to change every directory node to hold a SourceList
_source
of all children, then track changes to a child node's reactive propertyIsVisible
then do something like_source.Connect().AutoRefresh(x => x.IsVisible).Filter(x => x.IsVisible).BindTo(this, x => x.FilteredChildren);
where FilteredChildren is an ObservableCollection, then determine if this node should be visible withFilteredChildren.CountChanged.Select(x => x > 0).Subscribe(x => IsVisible = x)
(probably don't want ToPropertyEx here since IsVisible with be a regular reactive property not an ObservableAsProperty). Leaf nodes then listen to the search input children and change theirIsVisible
property accordingly, which should bubble up through the tree.Hoooopefully that approach is okay. It sounds very expensive but not sure of alternatives due to how TreeDataGrid works.
This is mostly blocked until #39 is merged. Someone could get started if they want, but pakfile explorer code on that branch may change.
The text was updated successfully, but these errors were encountered: