Skip to content

Commit

Permalink
Fixed #7666 - State save and restore events for Table
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed May 10, 2019
1 parent 1bb1646 commit e5c9481
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable

@Output() firstChange: EventEmitter<number> = new EventEmitter();

@Output() onStateSave: EventEmitter<any> = new EventEmitter();

@Output() onStateRestore: EventEmitter<any> = new EventEmitter();

@ViewChild('container') containerViewChild: ElementRef;

@ViewChild('resizeHelper') resizeHelperViewChild: ElementRef;
Expand Down Expand Up @@ -2049,6 +2053,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
if (Object.keys(state).length) {
storage.setItem(this.stateKey, JSON.stringify(state));
}

this.onStateSave.emit(state);
}

clearState() {
Expand Down Expand Up @@ -2102,6 +2108,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
}

this.stateRestored = true;

this.onStateRestore.emit(state);
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/app/showcase/components/table/tabledemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2673,6 +2673,16 @@ <h3>Events</h3>
event.checked: State of the header checkbox</td>
<td>Callback to invoke when state of header checkbox changes.</td>
</tr>
<tr>
<td>onStateSave</td>
<td>state: Table state</td>
<td>Callback to invoke table state is saved.</td>
</tr>
<tr>
<td>onStateRestore</td>
<td>state: Table state</td>
<td>Callback to invoke table state is restored.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit e5c9481

Please sign in to comment.