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

Commit d31e20f

Browse files
Ghislain BeaulacGhislain Beaulac
Ghislain Beaulac
authored and
Ghislain Beaulac
committed
fix(export): Export should work with datasetIdPropertyName, closes #67
1 parent 3fb5dab commit d31e20f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/modules/angular-slickgrid/services/export.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export class ExportService {
3434

3535
constructor(private translate: TranslateService) { }
3636

37+
private get datasetIdName(): string {
38+
return this._gridOptions && this._gridOptions.datasetIdPropertyName || 'id';
39+
}
40+
3741
/** Getter for the Grid Options pulled through the Grid Object */
3842
private get _gridOptions(): GridOption {
3943
return (this._grid && this._grid.getOptions) ? this._grid.getOptions() : {};
@@ -134,7 +138,7 @@ export class ExportService {
134138

135139
if (itemObj != null) {
136140
// Normal row (not grouped by anything) would have an ID which was predefined in the Grid Columns definition
137-
if (itemObj.id != null) {
141+
if (itemObj[this.datasetIdName] != null) {
138142
// get regular row item data
139143
outputDataStrings.push(this.readRegularRowData(columns, rowNumber, itemObj));
140144
} else if (this._hasGroupedItems && itemObj.__groupTotals === undefined) {

0 commit comments

Comments
 (0)