Skip to content

Commit a0343f5

Browse files
authored
Merge pull request #173 from IgniteUI/issue-167
Fixing duplicate event firing
2 parents 25e383f + 47c6a10 commit a0343f5

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

src/igniteui.angular2.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,12 +1205,12 @@ export class IgControlBase<Model> implements DoCheck {
12051205
}
12061206
}
12071207

1208-
optionChange() {
1208+
optionChange(options?) {
12091209
if (this._differ != null) {
12101210
var diff = [];
12111211
var element = jQuery(this._el);
12121212
var i, j, valKey = this._config.valueKey, option;
1213-
var opts = jQuery.extend(true, {}, this._config);
1213+
var opts = options || jQuery.extend(true, {}, this._config);
12141214
if (opts.dataSource) {
12151215
delete opts.dataSource;
12161216
}
@@ -1443,7 +1443,16 @@ export class IgGridBase<Model> extends IgControlBase<Model> implements AfterCont
14431443
}
14441444
}
14451445
}
1446-
allRows(){ };
1446+
allRows() { };
1447+
1448+
optionChange(options?) {
1449+
var opts = options || jQuery.extend(true, {}, this._config);
1450+
// Columns are modified internally by the grid. Excluding them from the change detection
1451+
if (opts.columns) {
1452+
delete opts.columns;
1453+
}
1454+
super.optionChange(opts);
1455+
}
14471456
}
14481457

14491458
@Component({

tests/unit/iggrid/grid.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,13 @@ export function main() {
518518
expect(fixture.debugElement.componentInstance.viewChild instanceof Infragistics.IgGridComponent)
519519
.toBe(true);
520520
fixture.componentInstance.data1 = [
521-
{ "Id": "4", "Date": "\/Date(1235088000000)\/" },
522-
{ "Id": "5", "Date": "\/Date(1250809200000)\/" },
523-
{ "Id": "6", "Date": "\/Date(1335394800000)\/" }
521+
{ "Id": "4", "Date": "2017-06-06" },
522+
{ "Id": "5", "Date": "2017-06-07" },
523+
{ "Id": "6", "Date": "2017-06-08" }
524524
];
525525
setTimeout(() => {
526526
fixture.detectChanges();
527-
$(fixture.debugElement.nativeElement).find("#grid1").igGridFiltering("filter", ([{ fieldName: "Date", expr: "\/Date(704678400000)\/", cond: "notOn" }]));
527+
$(fixture.debugElement.nativeElement).find("#grid1").igGridFiltering("filter", ([{ fieldName: "Date", expr: "2017-06-09", cond: "notOn" }]));
528528
expect($(fixture.debugElement.nativeElement).find("#grid1_container .ui-iggrid-results").text())
529529
.toBe("3 matching records");
530530
done();
@@ -560,14 +560,14 @@ class TestComponent {
560560
this.idHeaderText = "Product Id";
561561
this.pi = 1;
562562
this.data = [
563-
{ "Id": 1, "Name": "John Smith", "Age": 45, "HireDate": "\/Date(704678400000)\/" },
564-
{ "Id": 2, "Name": "Mary Johnson", "Age": 32, "HireDate": "\/Date(794678400000)\/" },
565-
{ "Id": 3, "Name": "Bob Ferguson", "Age": 27, "HireDate": "\/Date(834678400000)\/" }
563+
{ "Id": 1, "Name": "John Smith", "Age": 45, "HireDate": "2002-05-09" },
564+
{ "Id": 2, "Name": "Mary Johnson", "Age": 32, "HireDate": "2004-01-18" },
565+
{ "Id": 3, "Name": "Bob Ferguson", "Age": 27, "HireDate": "2003-03-03" }
566566
];
567567
this.data1 = [
568-
{ "Id": "1", "Date": "\/Date(1250809200000)\/" },
569-
{ "Id": "2", "Date": "\/Date(1335394800000)\/" },
570-
{ "Id": "3", "Date": "\/Date(1235088000000)\/" }
568+
{ "Id": "1", "Date": "2013-08-07" },
569+
{ "Id": "2", "Date": "2013-08-08" },
570+
{ "Id": "3", "Date": "2013-08-09" }
571571
];
572572
this.opts = {
573573
primaryKey: "Id",

0 commit comments

Comments
 (0)