@@ -362,6 +362,33 @@ export function main() {
362362 } , 10 ) ;
363363 } ) ;
364364 } ) ;
365+
366+ it ( 'should allow filtering after new data is applied' , ( done ) => {
367+ var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts2" [(dataSource)]="data1"></ig-grid></div>' ;
368+ TestBed . overrideComponent ( TestComponent , {
369+ set : {
370+ template : template
371+ }
372+ } ) ;
373+ TestBed . compileComponents ( ) . then ( ( ) => {
374+ let fixture = TestBed . createComponent ( TestComponent ) ;
375+ fixture . detectChanges ( ) ;
376+ expect ( fixture . debugElement . componentInstance . viewChild instanceof Infragistics . IgGridComponent )
377+ . toBe ( true ) ;
378+ fixture . componentInstance . data1 = [
379+ { "Id" :"4" , "Date" :"\/Date(1235088000000)\/" } ,
380+ { "Id" :"5" , "Date" :"\/Date(1250809200000)\/" } ,
381+ { "Id" :"6" , "Date" :"\/Date(1335394800000)\/" }
382+ ] ;
383+ setTimeout ( ( ) => {
384+ fixture . detectChanges ( ) ;
385+ $ ( fixture . debugElement . nativeElement ) . find ( "#grid1" ) . igGridFiltering ( "filter" , ( [ { fieldName : "Date" , expr : "\/Date(704678400000)\/" , cond : "notOn" } ] ) ) ;
386+ expect ( $ ( fixture . debugElement . nativeElement ) . find ( "#grid1_container .ui-iggrid-results" ) . text ( ) )
387+ . toBe ( "3 matching records" ) ;
388+ done ( ) ;
389+ } , 500 ) ;
390+ } ) ;
391+ } ) ;
365392 } ) ;
366393}
367394
@@ -372,8 +399,10 @@ export function main() {
372399class TestComponent {
373400 private opts : any ;
374401 public opts1 : any ;
402+ public opts2 : any ;
375403 private gridID : string ;
376404 public data : Array < any > ;
405+ public data1 : Array < any > ;
377406 private cdi : number ;
378407 public pi : number ;
379408 private firedEvent : any ;
@@ -391,16 +420,21 @@ class TestComponent {
391420 { "Id" : 1 , "Name" : "John Smith" , "Age" : 45 , "HireDate" : "\/Date(704678400000)\/" } ,
392421 { "Id" : 2 , "Name" : "Mary Johnson" , "Age" : 32 , "HireDate" : "\/Date(794678400000)\/" } ,
393422 { "Id" : 3 , "Name" : "Bob Ferguson" , "Age" : 27 , "HireDate" : "\/Date(834678400000)\/" }
394- ]
395- this . opts = {
423+ ] ;
424+ this . data1 = [
425+ { "Id" :"1" , "Date" :"\/Date(1250809200000)\/" } ,
426+ { "Id" :"2" , "Date" :"\/Date(1335394800000)\/" } ,
427+ { "Id" :"3" , "Date" :"\/Date(1235088000000)\/" }
428+ ] ;
429+ this . opts = {
396430 primaryKey : "Id" ,
397431 dataSource : this . data ,
398432 autoCommit : true ,
399433 features : [
400434 { name : "Updating" }
401435 ]
402436 } ;
403-
437+
404438 this . opts1 = {
405439 dataSource : this . data ,
406440 height : "300px" ,
@@ -417,6 +451,26 @@ class TestComponent {
417451 { name : "Updating" }
418452 ]
419453 } ;
454+
455+ this . opts2 = {
456+ width : "100%" ,
457+ height : "400px" ,
458+ autoCommit : true ,
459+ autoGenerateColumns : false ,
460+ columns : [
461+ { key : "Id" , headerText : "ID" , width : "20%" , dataType : "string" } ,
462+ { key : "Date" , headerText : "Date" , dataType : "date" , width : "80%" , format : "dd/MM/yyyy" } ,
463+ ] ,
464+ primaryKey : "Id" ,
465+ features : [
466+ {
467+ name : "Filtering" ,
468+ type : "local" ,
469+ mode : "simple" ,
470+ filterDialogContainment : "window"
471+ }
472+ ]
473+ } ;
420474 }
421475
422476 public cellClickHandler ( evt ) {
0 commit comments