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.

58 lines
1.7 KiB

/**
* 简单的复选下拉框控件, 适用于数据量少的情况
* 封装了字段处理逻辑
*
* Created by GUY on 2015/10/29.
* @class BI.ValueChooserPane
* @extends BI.Widget
*/
BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
_defaultConfig: function () {
return BI.extend(BI.ValueChooserPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-value-chooser-pane",
items: null,
itemsCreator: BI.emptyFn,
cache: true
});
},
_init: function () {
BI.ValueChooserPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.list = BI.createWidget({
7 years ago
type: "bi.multi_select_list",
element: this,
itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this)
});
this.list.on(BI.MultiSelectList.EVENT_CHANGE, function () {
self.fireEvent(BI.ValueChooserPane.EVENT_CHANGE);
});
if (BI.isNotNull(o.items)) {
this.items = o.items;
this.populate();
}
},
setValue: function (v) {
this.list.setValue(v);
},
getValue: function () {
var val = this.list.getValue() || {};
return {
type: val.type,
value: val.value
7 years ago
};
},
populate: function (items) {
// 直接用combo的populate不会作用到AbstractValueChooser上
this.items = items;
this.list.populate.apply(this.list, arguments);
}
});
BI.ValueChooserPane.EVENT_CHANGE = "ValueChooserPane.EVENT_CHANGE";
7 years ago
BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);