|
@@ -1,7 +1,6 @@
|
|
|
import _ from 'lodash'
|
|
|
import {combo} from '../Defaults'
|
|
|
import {baseConfig} from "./base";
|
|
|
-import {lookupScope, lookupFn} from "../lib/lib";
|
|
|
import {dataSourceReload} from "../DataSourceHelper";
|
|
|
|
|
|
export default function () {
|
|
@@ -21,20 +20,21 @@ export default function () {
|
|
|
fields: [newConfig.valueField, newConfig.displayField],
|
|
|
data: newConfig.data
|
|
|
}
|
|
|
- }
|
|
|
+ delete newConfig.data
|
|
|
|
|
|
- if (typeof newConfig.data !== 'object') {
|
|
|
+ } else if (typeof newConfig.data !== 'object') {
|
|
|
newConfig.store = {
|
|
|
fields: [newConfig.valueField, newConfig.displayField],
|
|
|
data: []
|
|
|
}
|
|
|
+ delete newConfig.data
|
|
|
}
|
|
|
}
|
|
|
|
|
|
cc.call(this, newConfig)
|
|
|
},
|
|
|
|
|
|
- setDataReal(value) {
|
|
|
+ setData(value) {
|
|
|
const {config} = value
|
|
|
if (!this.store) {
|
|
|
this.store = new Ext.data.Store({
|
|
@@ -47,32 +47,59 @@ export default function () {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ setLoading(value) {
|
|
|
+ if (value) {
|
|
|
+ if (!this.loadMask) {
|
|
|
+ this.loadMask = new Ext.LoadMask(this, {msg: "loading..."});
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.loadMask) {
|
|
|
+ this.loadMask.destroy()
|
|
|
+ delete this.loadMask
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ reload() {
|
|
|
+ dataSourceReload(this)
|
|
|
+ },
|
|
|
+
|
|
|
initComponent() {
|
|
|
+ const that = this
|
|
|
+ const toggle = () => {
|
|
|
+ if (that.isExpanded) {
|
|
|
+ that.collapse()
|
|
|
+
|
|
|
+ } else {
|
|
|
+ that.expand();
|
|
|
+ that.doQuery(that.allQuery, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.on({
|
|
|
afterrender() {
|
|
|
const {config} = this
|
|
|
- const scope = lookupScope(this)
|
|
|
|
|
|
- if (config.dataSource) {
|
|
|
- _.defer(() => {
|
|
|
- dataSourceReload(this)
|
|
|
- })
|
|
|
+ if (config.dataSource && config.autoLoad) {
|
|
|
+ dataSourceReload(this)
|
|
|
}
|
|
|
+
|
|
|
+ $(this.el.dom).on('click', toggle)
|
|
|
},
|
|
|
- focus: {
|
|
|
- // 获得焦点后自动下拉
|
|
|
- fn(sender) {
|
|
|
- sender.expand();
|
|
|
- this.doQuery(this.allQuery, true);
|
|
|
- },
|
|
|
+ destory() {
|
|
|
+ $(this.el.dom).off('click', toggle)
|
|
|
},
|
|
|
+ // focus: {
|
|
|
+ // // 获得焦点后自动下拉
|
|
|
+ // fn(sender) {
|
|
|
+ // sender.expand();
|
|
|
+ // this.doQuery(this.allQuery, true);
|
|
|
+ // },
|
|
|
+ // },
|
|
|
})
|
|
|
|
|
|
initComponent.call(this)
|
|
|
},
|
|
|
|
|
|
- reload() {
|
|
|
-
|
|
|
- }
|
|
|
});
|
|
|
}
|