Skip to content

Commit

Permalink
fixed #7057 - Table state not working when reorderableColumns being f…
Browse files Browse the repository at this point in the history
…alse
  • Loading branch information
yigitfindikli committed Jan 2, 2019
1 parent d450d19 commit e256305
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
this._columns = cols;
this.tableService.onColumnsChange(cols);

if (this._columns && this.isStateful() && !this.columnOrderStateRestored) {
if (this._columns && this.isStateful() && this.reorderableColumns && !this.columnOrderStateRestored ) {
this.restoreColumnOrder();
}
}
Expand Down Expand Up @@ -2038,14 +2038,12 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
if (stateString) {
let state: TableState = JSON.parse(stateString);
let columnOrder = state.columnOrder;
let reorderedColumns = [];

if (columnOrder) {
let reorderedColumns = [];
columnOrder.map(key => reorderedColumns.push(this.findColumnByKey(key)));
this.columnOrderStateRestored = true;
this.columns = reorderedColumns;
}

this.columnOrderStateRestored = true;
this.columns = reorderedColumns;
}
}

Expand Down

0 comments on commit e256305

Please sign in to comment.