Fixed #850 - state-save and state-restore events for Table
parent
b200e9efd1
commit
19379998a3
|
@ -143,7 +143,7 @@ export default {
|
||||||
emits: ['update:first', 'update:rows', 'page', 'update:sortField', 'update:sortOrder', 'update:multiSortMeta', 'sort', 'filter', 'row-click',
|
emits: ['update:first', 'update:rows', 'page', 'update:sortField', 'update:sortOrder', 'update:multiSortMeta', 'sort', 'filter', 'row-click',
|
||||||
'update:selection', 'row-select', 'row-unselect', 'update:contextMenuSelection', 'row-contextmenu', 'row-unselect-all', 'row-select-all',
|
'update:selection', 'row-select', 'row-unselect', 'update:contextMenuSelection', 'row-contextmenu', 'row-unselect-all', 'row-select-all',
|
||||||
'column-resize-end', 'column-reorder', 'row-reorder', 'update:expandedRows', 'row-collapse', 'row-expand',
|
'column-resize-end', 'column-reorder', 'row-reorder', 'update:expandedRows', 'row-collapse', 'row-expand',
|
||||||
'update:expandedRowGroups', 'rowgroup-collapse', 'rowgroup-expand', 'update:filters', 'virtual-scroll',
|
'update:expandedRowGroups', 'rowgroup-collapse', 'rowgroup-expand', 'update:filters', 'virtual-scroll', 'state-restore', 'state-save',
|
||||||
'cell-edit-init', 'cell-edit-complete', 'cell-edit-cancel', 'update:editingRows', 'row-edit-init', 'row-edit-save', 'row-edit-cancel'],
|
'cell-edit-init', 'cell-edit-complete', 'cell-edit-cancel', 'update:editingRows', 'row-edit-init', 'row-edit-save', 'row-edit-cancel'],
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
|
@ -1488,6 +1488,8 @@ export default {
|
||||||
if (Object.keys(state).length) {
|
if (Object.keys(state).length) {
|
||||||
storage.setItem(this.stateKey, JSON.stringify(state));
|
storage.setItem(this.stateKey, JSON.stringify(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('state-save', state);
|
||||||
},
|
},
|
||||||
restoreState() {
|
restoreState() {
|
||||||
const storage = this.getStorage();
|
const storage = this.getStorage();
|
||||||
|
@ -1536,6 +1538,8 @@ export default {
|
||||||
this.d_selectionKeys = restoredState.d_selectionKeys;
|
this.d_selectionKeys = restoredState.d_selectionKeys;
|
||||||
this.$emit('update:selection', restoredState.selection);
|
this.$emit('update:selection', restoredState.selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('state-restore', restoredState);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveColumnWidths(state) {
|
saveColumnWidths(state) {
|
||||||
|
|
|
@ -2345,6 +2345,42 @@ export default {
|
||||||
event.rows: Rows per page.</td>
|
event.rows: Rows per page.</td>
|
||||||
<td>Callback to invoke during virtual scrolling.</td>
|
<td>Callback to invoke during virtual scrolling.</td>
|
||||||
</tr>
|
</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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue