allow to clear input of data trees, fyi @joaomoreno
This commit is contained in:
parent
dea0095e83
commit
cf03ef33f4
1 changed files with 7 additions and 1 deletions
|
@ -47,13 +47,19 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
|
|||
return this.input;
|
||||
}
|
||||
|
||||
setInput(input: TInput, viewState?: IDataTreeViewState): void {
|
||||
setInput(input: TInput | undefined, viewState?: IDataTreeViewState): void {
|
||||
if (viewState && !this.identityProvider) {
|
||||
throw new TreeError(this.user, 'Can\'t restore tree view state without an identity provider');
|
||||
}
|
||||
|
||||
this.input = input;
|
||||
|
||||
if (!input) {
|
||||
this.nodesByIdentity.clear();
|
||||
this.model.setChildren(null, Iterable.empty());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!viewState) {
|
||||
this._refresh(input);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue