11import { Component , OnInit , ViewChild } from '@angular/core' ;
22
3- import { IgxGridComponent , IgxSnackbarComponent } from 'igniteui-angular' ;
3+ import { IgxGridComponent , IgxSnackbarComponent , IRowSelectionEventArgs } from 'igniteui-angular' ;
44import { Observable } from 'rxjs' ;
55import { FinancialDataService } from '../../services/financial.service' ;
66
@@ -21,6 +21,7 @@ export class GridSelectionSampleComponent implements OnInit {
2121 public selectionModes = [ ] ;
2222 public hideRowSelectors = false ;
2323 public selectedRows = [ 1 , 2 , 3 ] ;
24+ public selectedRowsCount ;
2425
2526 constructor ( private localService : FinancialDataService ) {
2627 this . localService . getData ( 100000 ) ;
@@ -33,22 +34,23 @@ export class GridSelectionSampleComponent implements OnInit {
3334
3435 }
3536 public ngOnInit ( ) : void {
36- this . snackbar . autoHide = false ;
37+ this . snackbar . autoHide = true ;
3738 this . snackbar . open ( ) ;
3839 }
39-
4040 public formatNumber ( value : number ) {
4141 return value . toFixed ( 2 ) ;
4242 }
4343 public formatCurrency ( value : number ) {
4444 return '$' + value . toFixed ( 2 ) ;
4545 }
46- public handleRowSelection ( event ) {
47- const targetCell = event . cell ;
46+ public handleRowSelection ( event :IRowSelectionEventArgs ) {
47+ this . selectedRowsCount = event . newSelection . length ;
48+ this . snackbar . open ( ) ;
4849 }
4950
5051 public selectCellSelectionMode ( args ) {
5152 this . selectionMode = this . selectionModes [ args . index ] . label ;
5253 this . snackbar . open ( ) ;
54+ this . selectedRowsCount = undefined ;
5355 }
5456}
0 commit comments