@@ -8,52 +8,21 @@ import { IgxGridComponent, FilteringExpressionsTree, IgxStringFilteringOperand,
88 styleUrls : [ 'grid-filtering.sample.css' ] ,
99 templateUrl : 'grid-filtering.sample.html'
1010} )
11- export class GridFilteringComponent implements OnInit , AfterViewInit {
11+ export class GridFilteringComponent implements OnInit {
1212
1313 public data : Array < any > ;
1414 public columns : Array < any > ;
1515 public displayDensities ;
1616 public filterModes ;
1717 public density = 'comfortable' ;
18+ public advancedFilteringTree : FilteringExpressionsTree ;
1819
1920 @ViewChild ( 'grid1' , { static : true } )
2021 public grid1 : IgxGridComponent ;
2122
2223 @ViewChild ( 'applyChangesCheckbox' , { static : true } )
2324 public applyChangesCheckbox : IgxCheckboxComponent ;
2425
25- ngAfterViewInit ( ) : void {
26- const tree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
27- tree . filteringOperands . push ( {
28- fieldName : 'ID' ,
29- condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
30- searchVal : 'a' ,
31- ignoreCase : true
32- } ) ;
33- const orTree = new FilteringExpressionsTree ( FilteringLogic . Or ) ;
34- orTree . filteringOperands . push ( {
35- fieldName : 'ID' ,
36- condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
37- searchVal : 'b' ,
38- ignoreCase : true
39- } ) ;
40- orTree . filteringOperands . push ( {
41- fieldName : 'CompanyName' ,
42- condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
43- searchVal : 'c' ,
44- ignoreCase : true
45- } ) ;
46- tree . filteringOperands . push ( orTree ) ;
47- tree . filteringOperands . push ( {
48- fieldName : 'CompanyName' ,
49- condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
50- searchVal : 'd' ,
51- ignoreCase : true
52- } ) ;
53-
54- this . grid1 . advancedFilteringExpressionsTree = tree ;
55- }
56-
5726 public ngOnInit ( ) : void {
5827 this . displayDensities = [
5928 { label : 'comfortable' , selected : this . density === 'comfortable' , togglable : true } ,
@@ -523,6 +492,36 @@ export class GridFilteringComponent implements OnInit, AfterViewInit {
523492 'Contract' : false
524493 }
525494 ] ;
495+
496+ const tree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
497+ tree . filteringOperands . push ( {
498+ fieldName : 'ID' ,
499+ condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
500+ searchVal : 'a' ,
501+ ignoreCase : true
502+ } ) ;
503+ const orTree = new FilteringExpressionsTree ( FilteringLogic . Or ) ;
504+ orTree . filteringOperands . push ( {
505+ fieldName : 'ID' ,
506+ condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
507+ searchVal : 'b' ,
508+ ignoreCase : true
509+ } ) ;
510+ orTree . filteringOperands . push ( {
511+ fieldName : 'CompanyName' ,
512+ condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
513+ searchVal : 'c' ,
514+ ignoreCase : true
515+ } ) ;
516+ tree . filteringOperands . push ( orTree ) ;
517+ tree . filteringOperands . push ( {
518+ fieldName : 'CompanyName' ,
519+ condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
520+ searchVal : 'd' ,
521+ ignoreCase : true
522+ } ) ;
523+
524+ this . advancedFilteringTree = tree ;
526525 }
527526
528527 public selectDensity ( event ) {
0 commit comments