Skip to content

Commit ba691ac

Browse files
committed
samples(treeGrid): fix filtering in treeGrid finJS demo #1189
1 parent 1a26cc8 commit ba691ac

File tree

1 file changed

+8
-29
lines changed

1 file changed

+8
-29
lines changed

src/app/treegrid-finjs/tree-grid-finjs-sample.component.ts

+8-29
Original file line numberDiff line numberDiff line change
@@ -235,32 +235,11 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
235235
}
236236

237237
private ticker(data: any) {
238-
this.zone.runOutsideAngular(() => {
239-
this.updateRandomPrices(data);
240-
this.recalculateAggregations(this.grid1.data);
241-
this.zone.run(() => this.grid1.markForCheck());
242-
});
238+
this.data = this.updateRandomPrices(data);
243239
}
244240

245241
private tickerAllPrices(data: any) {
246-
this.zone.runOutsideAngular(() => {
247-
this.updateAllPrices(data);
248-
this.recalculateAggregations(this.grid1.data);
249-
this.zone.run(() => this.grid1.markForCheck());
250-
});
251-
}
252-
253-
private recalculateAggregations(data: any[]) {
254-
for (const parent of data) {
255-
const children = parent[this.childDataKey];
256-
257-
if (children && children.length) {
258-
for (const aggregation of this.aggregations) {
259-
parent[aggregation.field] = aggregation.aggregate(parent, children);
260-
}
261-
this.recalculateAggregations(children);
262-
}
263-
}
242+
this.data = this.updateAllPrices(data);
264243
}
265244

266245
/**
@@ -269,10 +248,10 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
269248
private updateAllPrices(data: any[]): any {
270249
const newData = data.slice();
271250
for (const dataRow of newData) {
272-
this.randomizeObjectData(dataRow);
251+
this.randomizeObjectData(dataRow);
273252
}
274253
return newData;
275-
}
254+
}
276255

277256
/**
278257
* Updates values in random number of records
@@ -281,11 +260,11 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
281260
const newData = data.slice();
282261
let y = 0;
283262
for (let i = Math.round(Math.random() * 10); i < newData.length; i += Math.round(Math.random() * 10)) {
284-
this.randomizeObjectData(newData[i]);
285-
y++;
263+
this.randomizeObjectData(newData[i]);
264+
y++;
286265
}
287266
return newData;
288-
}
267+
}
289268

290269
/**
291270
* Generates ne values for Change, Price and ChangeP columns
@@ -320,5 +299,5 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
320299

321300
get buttonSelected(): number {
322301
return this.selectedButton || this.selectedButton === 0 ? this.selectedButton : -1;
323-
}
302+
}
324303
}

0 commit comments

Comments
 (0)