Skip to content

Commit ae1c313

Browse files
refactor nested items
1 parent 33b8548 commit ae1c313

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/devextreme-angular/src/core/nested-option.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,22 @@ export interface ICollectionNestedOptionContainer {
155155
}
156156

157157
export class CollectionNestedOptionContainerImpl implements ICollectionNestedOptionContainer {
158+
private _activatedQueries = {};
159+
158160
constructor(private readonly _setOption: Function, private readonly _filterItems?: Function) { }
159161

160-
setChildren(propertyName, items) {
162+
setChildren<T extends ICollectionNestedOption>(propertyName: string, items: QueryList<T>) {
161163
if (this._filterItems) {
162164
items = this._filterItems(items);
163165
}
164-
165166
if (items.length) {
167+
this._activatedQueries[propertyName] = true;
168+
}
169+
if (this._activatedQueries[propertyName]) {
166170
const widgetItems = items.map((item, index) => {
167171
item._index = index;
168172
return item._value;
169173
});
170-
171174
this._setOption(propertyName, widgetItems);
172175
}
173176
}

0 commit comments

Comments
 (0)