@@ -235,32 +235,11 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
235
235
}
236
236
237
237
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 ) ;
243
239
}
244
240
245
241
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 ) ;
264
243
}
265
244
266
245
/**
@@ -269,10 +248,10 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
269
248
private updateAllPrices ( data : any [ ] ) : any {
270
249
const newData = data . slice ( ) ;
271
250
for ( const dataRow of newData ) {
272
- this . randomizeObjectData ( dataRow ) ;
251
+ this . randomizeObjectData ( dataRow ) ;
273
252
}
274
253
return newData ;
275
- }
254
+ }
276
255
277
256
/**
278
257
* Updates values in random number of records
@@ -281,11 +260,11 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
281
260
const newData = data . slice ( ) ;
282
261
let y = 0 ;
283
262
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 ++ ;
286
265
}
287
266
return newData ;
288
- }
267
+ }
289
268
290
269
/**
291
270
* Generates ne values for Change, Price and ChangeP columns
@@ -320,5 +299,5 @@ export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
320
299
321
300
get buttonSelected ( ) : number {
322
301
return this . selectedButton || this . selectedButton === 0 ? this . selectedButton : - 1 ;
323
- }
302
+ }
324
303
}
0 commit comments