1- import { Component , HostBinding , OnDestroy , ViewChild } from '@angular/core' ;
2- import { IgxDialogComponent } from 'igniteui-angular' ;
1+ import { AfterViewInit , Component , HostBinding , OnDestroy , ViewChild } from '@angular/core' ;
2+ import { IgxDialogComponent , IgxOverlayOutletDirective , OverlaySettings } from 'igniteui-angular' ;
33import { IgxCategoryChartComponent } from 'igniteui-angular-charts' ;
44import { Stock } from '../data/financialData' ;
55import { ControllerComponent } from './controllers.component' ;
@@ -10,11 +10,17 @@ import { GridFinJSComponent } from './grid-finjs.component';
1010 styleUrls : [ './main.component.scss' ] ,
1111 templateUrl : './main.component.html'
1212} )
13- export class FinJSDemoComponent implements OnDestroy {
13+ export class FinJSDemoComponent implements OnDestroy , AfterViewInit {
1414 @ViewChild ( 'finGrid' , { static : true } ) public finGrid : GridFinJSComponent ;
1515 @ViewChild ( 'controllers' , { static : true } ) public controller : ControllerComponent ;
1616 @ViewChild ( 'dialog' , { static : true } ) public dialog : IgxDialogComponent ;
1717 @ViewChild ( 'chart1' , { static : true } ) public chart : IgxCategoryChartComponent ;
18+ @ViewChild ( IgxOverlayOutletDirective , { static : true } ) public outlet : IgxOverlayOutletDirective ;
19+
20+ public overlaySettings : OverlaySettings = {
21+ modal : false ,
22+ closeOnOutsideClick : true
23+ } ;
1824
1925 @HostBinding ( 'class.dark-theme' )
2026 public darkTheme = false ;
@@ -43,6 +49,10 @@ export class FinJSDemoComponent implements OnDestroy {
4349 }
4450 }
4551
52+ public ngAfterViewInit ( ) : void {
53+ this . overlaySettings . outlet = this . outlet ;
54+ }
55+
4656 public onVolumeChanged ( volume : number ) : void {
4757 this . volume = volume ;
4858 this . finGrid . dataService . hasRemoteConnection ? this . finGrid . dataService
@@ -71,7 +81,7 @@ export class FinJSDemoComponent implements OnDestroy {
7181 case 'chart' : {
7282 if ( this . finGrid . grid . selectedRows . length !== 0 ) {
7383 this . setChartData ( this . finGrid . grid . selectedRows ) ;
74- this . dialog . open ( ) ;
84+ this . dialog . open ( this . overlaySettings ) ;
7585 } else {
7686 this . controller . toast . open ( 'Please select some rows first!' ) ;
7787 } ;
@@ -85,7 +95,8 @@ export class FinJSDemoComponent implements OnDestroy {
8595
8696 public setChartData ( args : Stock [ ] ) : void {
8797 this . chartData = [ ] ;
88- args . forEach ( row => {
98+ args . forEach ( rowKey => {
99+ const row : Stock = this . finGrid . grid . getRowByKey ( rowKey ) . data ;
89100 this . chartData . push ( row ) ;
90101 this . chart . notifyInsertItem ( this . chartData , this . chartData . length - 1 , row ) ;
91102 } ) ;
0 commit comments