fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.7 KiB

8 years ago
/**
* 简单的复选下拉树控件, 适用于数据量少的情况
*
* Created by GUY on 2015/10/29.
* @class BI.TreeValueChooserCombo
* @extends BI.Widget
*/
BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
8 years ago
_defaultConfig: function () {
return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tree-value-chooser-combo",
width: 200,
height: 24,
8 years ago
items: null,
itemsCreator: BI.emptyFn,
isNeedAdjustWidth: true
8 years ago
});
},
_init: function () {
BI.TreeValueChooserCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNotNull(o.items)) {
this._initData(o.items);
}
this.combo = BI.createWidget({
7 years ago
type: "bi.multi_tree_combo",
text: o.text,
allowEdit: o.allowEdit,
value: o.value,
watermark: o.watermark,
8 years ago
element: this,
8 years ago
itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this),
8 years ago
width: o.width,
height: o.height,
isNeedAdjustWidth: o.isNeedAdjustWidth,
listeners: [{
eventName: BI.MultiTreeCombo.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_FOCUS);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_BLUR,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_BLUR);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_STOP,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_STOP);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_CLICK_ITEM,
action: function (v) {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_CLICK_ITEM, v);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_SEARCHING,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_SEARCHING);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_CONFIRM,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_BEFORE_POPUPVIEW);
}
}]
8 years ago
});
},
showView: function () {
this.combo.showView();
},
hideView: function () {
this.combo.hideView();
},
8 years ago
setValue: function (v) {
this.combo.setValue(v);
},
getValue: function () {
return this.combo.getValue();
},
getAllValue: function() {
return this.buildCompleteTree(this.combo.getValue());
},
populate: function (items) {
this._initData(items);
this.combo.populate();
8 years ago
}
});
BI.TreeValueChooserCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.TreeValueChooserCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.TreeValueChooserCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.TreeValueChooserCombo.EVENT_BLUR = "EVENT_BLUR";
BI.TreeValueChooserCombo.EVENT_STOP = "EVENT_STOP";
BI.TreeValueChooserCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.TreeValueChooserCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.shortcut("bi.tree_value_chooser_combo", BI.TreeValueChooserCombo);