Skip to content

Commit

Permalink
Fixed #901 - state-save and state-restore events for Table
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jan 28, 2021
1 parent 3544062 commit 0d094ff
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,8 @@ export default {
if (Object.keys(state).length) {
storage.setItem(this.stateKey, JSON.stringify(state));
}
this.$emit('state-save', state);
},
restoreState() {
const storage = this.getStorage();
Expand Down Expand Up @@ -1534,6 +1536,8 @@ export default {
this.d_selectionKeys = restoredState.d_selectionKeys;
this.$emit('update:selection', restoredState.selection);
}
this.$emit('state-restore', restoredState);
}
},
saveColumnWidths(state) {
Expand Down
36 changes: 36 additions & 0 deletions src/views/datatable/DataTableDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,42 @@ export default {
event.rows: Rows per page.</td>
<td>Callback to invoke during virtual scrolling.</td>
</tr>
<tr>
<td>state-save</td>
<td>event.first: Index of first record <br/>
event.rows: Number of rows to display in new page <br/>
event.sortField: Field to sort against <br />
event.sortOrder: Sort order as integer <br />
event.multiSortMeta: MultiSort metadata <br />
event.filters: Collection of active filters <br />
event.columWidths: Comma separated list of column widths <br />
event.columnOrder: Order of the columns <br />
event.expandedRows: Instances of rows in expanded state <br />
event.expandedRowKeys: Keys of rows in expanded state <br />
event.expandedRowGroups: Instances of row groups in expanded state <br />
event.selection: Selected rows <br />
event.selectionKeys: Keys of selected rows <br />
</td>
<td>Invoked when a stateful table saves the state.</td>
</tr>
<tr>
<td>state-restore</td>
<td>event.first: Index of first record <br/>
event.rows: Number of rows to display in new page <br/>
event.sortField: Field to sort against <br />
event.sortOrder: Sort order as integer <br />
event.multiSortMeta: MultiSort metadata <br />
event.filters: Collection of active filters <br />
event.columWidths: Comma separated list of column widths <br />
event.columnOrder: Order of the columns <br />
event.expandedRows: Instances of rows in expanded state <br />
event.expandedRowKeys: Keys of rows in expanded state <br />
event.expandedRowGroups: Instances of row groups in expanded state <br />
event.selection: Selected rows <br />
event.selectionKeys: Keys of selected rows <br />
</td>
<td>Invoked when a stateful table restores the state.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 0d094ff

Please sign in to comment.