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.

78 lines
2.4 KiB

/**
* Created by roy on 15/8/14.
*/
BI.DownListCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-down-list-combo",
invalid: false,
height: 25,
items: [],
adjustLength: 0,
el: {}
})
},
_init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popupview = BI.createWidget({
type: "bi.down_list_popup",
items: o.items,
chooseType: o.chooseType
});
this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
});
this.popupview.on(BI.DownListPopup.EVENT_SON_VALUE_CHANGE, function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
});
this.downlistcombo = BI.createWidget({
element: this,
type: 'bi.combo',
isNeedAdjustWidth: false,
adjustLength: o.adjustLength,
el: BI.createWidget(o.el, {
type: "bi.icon_trigger",
extraCls: o.iconCls ? o.iconCls : "pull-down-font",
width: o.width,
height: o.height
}),
popup: {
el: this.popupview,
stopPropagation: true,
7 years ago
maxHeight: 1000
}
});
this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
});
},
7 years ago
hideView: function () {
this.downlistcombo.hideView();
},
populate: function (items) {
this.popupview.populate(items);
},
setValue: function (v) {
this.popupview.setValue(v);
},
getValue: function () {
return this.popupview.getValue()
}
});
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
7 years ago
BI.shortcut("bi.down_list_combo", BI.DownListCombo);