@@ -18,6 +18,7 @@ import {
1818 OperatorType ,
1919 SortComparers ,
2020 SlickGlobalEditorLock ,
21+ type SlickGrid ,
2122 type SliderOption ,
2223 type VanillaCalendarOption ,
2324} from '../../library' ;
@@ -70,7 +71,7 @@ export class Example3Component implements OnInit {
7071 columnDefinitions ! : Column [ ] ;
7172 gridOptions ! : GridOption ;
7273 dataset ! : any [ ] ;
73- gridObj : any ;
74+ gridObj : SlickGrid | undefined ;
7475 hideSubTitle = false ;
7576 isAutoEdit = true ;
7677 alertWarning : any ;
@@ -630,7 +631,7 @@ export class Example3Component implements OnInit {
630631
631632 changeAutoCommit ( ) {
632633 this . gridOptions . autoCommitEdit = ! this . gridOptions . autoCommitEdit ;
633- this . gridObj . setOptions ( {
634+ this . gridObj ? .setOptions ( {
634635 autoCommitEdit : this . gridOptions . autoCommitEdit ,
635636 } ) ;
636637 return true ;
@@ -680,7 +681,7 @@ export class Example3Component implements OnInit {
680681
681682 setAutoEdit ( isAutoEdit : boolean ) {
682683 this . isAutoEdit = isAutoEdit ;
683- this . gridObj . setOptions ( { autoEdit : isAutoEdit } ) ; // change the grid option dynamically
684+ this . gridObj ? .setOptions ( { autoEdit : isAutoEdit } ) ; // change the grid option dynamically
684685 return true ;
685686 }
686687
@@ -689,7 +690,7 @@ export class Example3Component implements OnInit {
689690 // const item = this.angularGrid.dataView.getItem(command.row);
690691 if ( command && SlickGlobalEditorLock . cancelCurrentEdit ( ) ) {
691692 command . undo ( ) ;
692- this . gridObj . gotoCell ( command . row , command . cell , false ) ;
693+ this . gridObj ? .gotoCell ( command . row , command . cell , false ) ;
693694 }
694695 }
695696
0 commit comments