diff --git a/package.json b/package.json index 7587287e..64f68f7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-datatables", - "version": "16.0.0", + "version": "16.0.1", "description": "Angular directive for DataTables", "scripts": { "build": "npm run clean && npm run compile && npm run bundles && npm run schematics:build", diff --git a/src/angular-datatables.directive.ts b/src/angular-datatables.directive.ts index 4998c3ec..657b9eb0 100644 --- a/src/angular-datatables.directive.ts +++ b/src/angular-datatables.directive.ts @@ -75,6 +75,10 @@ export class DataTableDirective implements OnDestroy, OnInit { reject('Both the table and dtOptions cannot be empty'); return; } + + // Set a column unique + resolvedDTOptions.columns.forEach((col: ADTColumns, i: number) => col.id = i); + // Using setTimeout as a "hack" to be "part" of NgZone setTimeout(() => { // Assign DT properties here @@ -108,7 +112,7 @@ export class DataTableDirective implements OnDestroy, OnInit { const pipe = el.ngPipeInstance; const pipeArgs = el.ngPipeArgs || []; // find index of column using `data` attr - const i = columns.filter(c => c.visible !== false).findIndex(e => e.data === el.data); + const i = columns.filter(c => c.visible !== false).findIndex(e => e.id === el.id); // get