add button to clear search
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -18,6 +18,10 @@ export default class SearchViewModel<T> {
|
||||
[this.searchInput, this.appliedQuery],
|
||||
() => this.searchInput.value == this.appliedQuery.value,
|
||||
);
|
||||
cannotClear: React.State<boolean> = React.createProxyState(
|
||||
[this.searchInput],
|
||||
() => this.searchInput.value == "",
|
||||
);
|
||||
|
||||
// methods
|
||||
search = (searchTerm: string): void => {
|
||||
@@ -37,6 +41,10 @@ export default class SearchViewModel<T> {
|
||||
}
|
||||
};
|
||||
|
||||
clear = (): void => {
|
||||
this.searchInput.value = "";
|
||||
}
|
||||
|
||||
// init
|
||||
constructor(
|
||||
allObjects: React.ListState<T> | React.MapState<T>,
|
||||
|
||||
Reference in New Issue
Block a user