UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

38 lines (37 loc) 1.36 kB
/** * DevExtreme (esm/__internal/grids/tree_list/module_state_storing.js) * Version: 22.1.9 * Build date: Tue Apr 18 2023 * * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { extend } from "../../../core/utils/extend"; import { stateStoringModule } from "../../../ui/grid_core/ui.grid_core.state_storing"; import treeListCore from "./module_core"; const origApplyState = stateStoringModule.extenders.controllers.stateStoring.applyState; treeListCore.registerModule("stateStoring", extend(true, {}, stateStoringModule, { extenders: { controllers: { stateStoring: { applyState(state) { origApplyState.apply(this, arguments); this.option("expandedRowKeys", state.expandedRowKeys ? state.expandedRowKeys.slice() : []) } }, data: { getUserState() { const state = this.callBase.apply(this, arguments); if (!this.option("autoExpandAll")) { state.expandedRowKeys = this.option("expandedRowKeys") } return state } } } } }));