diff options
Diffstat (limited to 'pkg/gui/context/filtered_list_view_model.go')
-rw-r--r-- | pkg/gui/context/filtered_list_view_model.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/gui/context/filtered_list_view_model.go b/pkg/gui/context/filtered_list_view_model.go new file mode 100644 index 000000000..01b020841 --- /dev/null +++ b/pkg/gui/context/filtered_list_view_model.go @@ -0,0 +1,26 @@ +package context + +type FilteredListViewModel[T any] struct { + *FilteredList[T] + *ListViewModel[T] +} + +func NewFilteredListViewModel[T any](getList func() []T, getFilterFields func(T) []string) *FilteredListViewModel[T] { + filteredList := &FilteredList[T]{ + getList: getList, + getFilterFields: getFilterFields, + } + + self := &FilteredListViewModel[T]{ + FilteredList: filteredList, + } + + listViewModel := NewListViewModel(filteredList.GetList) + + self.ListViewModel = listViewModel + + return self +} + +// used for type switch +func (self *FilteredListViewModel[T]) IsFilterableContext() {} |