Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 2724c97

Browse files
committed
fix: registered external resouces should keep singleton ref
- external resources can be provided through the grid options, but these options are sometime deep copied and that might have the side effect of losing the singleton ref of the instantiate services/resources, instead we can simply keep these singleton refs before any grid options merge can happen and that is in the constructor before the grid initializes and before the grid options are merged and sometime deep copied with global options
1 parent 567f47b commit 2724c97

15 files changed

+113
-81
lines changed

src/app/examples/grid-clientside.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export class GridClientSideComponent implements OnInit {
196196
{ columnId: 'complete', direction: 'ASC' }
197197
],
198198
},
199-
registerExternalResources: [new ExcelExportService()],
199+
externalResources: [new ExcelExportService()],
200200
};
201201

202202
// mock a dataset

src/app/examples/grid-colspan.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class GridColspanComponent implements OnInit {
6868
excelExportOptions: {
6969
exportWithFormatter: false
7070
},
71-
registerExternalResources: [new ExcelExportService()],
71+
externalResources: [new ExcelExportService()],
7272
};
7373

7474
this.dataset1 = this.getData(500);
@@ -100,7 +100,7 @@ export class GridColspanComponent implements OnInit {
100100
excelExportOptions: {
101101
exportWithFormatter: false
102102
},
103-
registerExternalResources: [new ExcelExportService()],
103+
externalResources: [new ExcelExportService()],
104104
};
105105

106106
this.dataset2 = this.getData(500);

src/app/examples/grid-composite-editor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ export class GridCompositeEditorComponent implements OnInit {
394394
excelExportOptions: {
395395
exportWithFormatter: false
396396
},
397-
registerExternalResources: [new ExcelExportService(), this.compositeEditorInstance],
397+
externalResources: [new ExcelExportService(), this.compositeEditorInstance],
398398
enableFiltering: true,
399399
rowSelectionOptions: {
400400
// True (Single Selection), False (Multiple Selections)

src/app/examples/grid-contextmenu.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export class GridContextMenuComponent implements OnInit, OnDestroy {
297297
columnHeaderStyle: { font: { bold: true, italic: true } }
298298
},
299299
i18n: this.translate,
300-
registerExternalResources: [new ExcelExportService()],
300+
externalResources: [new ExcelExportService()],
301301

302302
enableContextMenu: true,
303303
enableCellMenu: true,

src/app/examples/grid-custom-tooltip.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export class GridCustomTooltipComponent implements OnInit {
323323
exportWithFormatter: true
324324
},
325325
// Custom Tooltip options can be defined in a Column or Grid Options or a mixed of both (first options found wins)
326-
registerExternalResources: [new SlickCustomTooltip(), new ExcelExportService()],
326+
externalResources: [new SlickCustomTooltip(), new ExcelExportService()],
327327
customTooltip: {
328328
formatter: this.tooltipFormatter.bind(this) as Formatter,
329329
headerFormatter: this.headerFormatter,

src/app/examples/grid-draggrouping.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class GridDraggableGroupingComponent implements OnInit {
244244
enableTextExport: true,
245245
enableExcelExport: true,
246246
excelExportOptions: { sanitizeDataExport: true },
247-
registerExternalResources: [this.excelExportService, this.textExportService],
247+
externalResources: [this.excelExportService, this.textExportService],
248248
};
249249

250250
this.loadData(500);

src/app/examples/grid-graphql.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class GridGraphqlComponent implements OnInit, OnDestroy {
276276
setTimeout(() => {
277277
this.graphqlQuery = this.angularGrid.backendService!.buildQuery();
278278
if (this.isWithCursor) {
279-
// When using cursor pagination, the pagination service needs to updated with the PageInfo data from the latest request
279+
// When using cursor pagination, the pagination service needs to be updated with the PageInfo data from the latest request
280280
// This might be done automatically if using a framework specific slickgrid library
281281
// Note because of this timeout, this may cause race conditions with rapid clicks!
282282
this.angularGrid?.paginationService?.setCursorPageInfo((mockedResult.data[GRAPHQL_QUERY_DATASET_NAME].pageInfo));

src/app/examples/grid-grouping.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class GridGroupingComponent implements OnInit {
165165
},
166166
excelExportOptions: { sanitizeDataExport: true },
167167
textExportOptions: { sanitizeDataExport: true },
168-
registerExternalResources: [this.excelExportService, this.textExportService],
168+
externalResources: [this.excelExportService, this.textExportService],
169169
};
170170

171171
this.loadData(500);

src/app/examples/grid-localization.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class GridLocalizationComponent implements OnInit, OnDestroy {
202202
exportWithFormatter: true,
203203
sanitizeDataExport: true
204204
},
205-
registerExternalResources: [this.excelExportService, this.textExportService],
205+
externalResources: [this.excelExportService, this.textExportService],
206206
};
207207

208208
this.loadData(NB_ITEMS);

src/app/examples/grid-range.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class GridRangeComponent implements OnInit, OnDestroy {
184184
{ columnId: 'duration', direction: 'ASC' },
185185
],
186186
},
187-
registerExternalResources: [new SlickCustomTooltip(), new ExcelExportService()],
187+
externalResources: [new SlickCustomTooltip(), new ExcelExportService()],
188188
};
189189

190190
// mock a dataset

0 commit comments

Comments
 (0)