|
@@ -28,7 +28,6 @@ export default function () {
|
|
|
constructor(config) {
|
|
|
const me = this
|
|
|
const {dataSource} = config
|
|
|
-
|
|
|
this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config)
|
|
|
if (Array.isArray(config.columns) && config.columns.length > 0) {
|
|
|
const cacheData = this.getColumnConfigCache()
|
|
@@ -44,6 +43,7 @@ export default function () {
|
|
|
column.width = itData.width
|
|
|
}
|
|
|
column.hidden = itData.hidden
|
|
|
+ column.locked = itData.locked
|
|
|
newColumns.push(column)
|
|
|
break
|
|
|
}
|
|
@@ -100,6 +100,22 @@ export default function () {
|
|
|
handler: this.clearFilter
|
|
|
})
|
|
|
}
|
|
|
+ if (!newConfig.hideSaveGridUIConfig) {
|
|
|
+ buttons.push({
|
|
|
+ xtype: 'button',
|
|
|
+ tooltip: '保存表格自定义配置',
|
|
|
+ iconCls: 'x-fa fa-save',
|
|
|
+ handler: this.saveGridUIConfig
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (!newConfig.hideClearGridUIConfig) {
|
|
|
+ buttons.push({
|
|
|
+ xtype: 'button',
|
|
|
+ tooltip: '清空表格自定义配置',
|
|
|
+ iconCls: 'x-fa fa-close',
|
|
|
+ handler: this.clearGridUIConfig
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
if (!newConfig.hideFootbar) {
|
|
|
if (newConfig.pagination) {
|
|
@@ -414,7 +430,8 @@ export default function () {
|
|
|
// 生成列自定义的缓存key
|
|
|
makeColumnConfigCacheKey(config) {
|
|
|
const me = this
|
|
|
- let key = "gridColumnCache-" + window.location.href
|
|
|
+ const scope = config.$initParent.yvanScope || config.$initParent.lookupReferenceHolder().yvanScope;
|
|
|
+ let key = "gridColumnCache-" + scope.scopeKey + "-"
|
|
|
if (config.reference) {
|
|
|
key += config.reference
|
|
|
} else {
|
|
@@ -451,6 +468,7 @@ export default function () {
|
|
|
dataIndex: column.dataIndex,
|
|
|
width: column.width,
|
|
|
hidden: column.hidden,
|
|
|
+ locked: column.locked,
|
|
|
index
|
|
|
})
|
|
|
index++
|
|
@@ -477,6 +495,17 @@ export default function () {
|
|
|
sender.up('grid').filters.clearFilters();
|
|
|
},
|
|
|
|
|
|
+ saveGridUIConfig(sender) {
|
|
|
+ const grid = sender.up('grid')
|
|
|
+ grid.setColumnConfigCache()
|
|
|
+ },
|
|
|
+
|
|
|
+ clearGridUIConfig(sender) {
|
|
|
+ const grid = sender.up('grid')
|
|
|
+ const key = grid.columnConfigCacheKey
|
|
|
+ localStorage.setItem(key, "")
|
|
|
+ },
|
|
|
+
|
|
|
setLoading(value) {
|
|
|
if (value) {
|
|
|
this.mask('读取中')
|