|
|
|
/**
|
|
|
|
* 查看已选switcher
|
|
|
|
* Created by guy on 15/11/3.
|
|
|
|
* @class BI.MultiSelectCheckSelectedSwitcher
|
|
|
|
* @extends Widget
|
|
|
|
*/
|
|
|
|
BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, {
|
|
|
|
|
|
|
|
_defaultConfig: function () {
|
|
|
|
return BI.extend(BI.MultiSelectCheckSelectedSwitcher.superclass._defaultConfig.apply(this, arguments), {
|
|
|
|
baseCls: 'bi-multi-select-check-selected-switcher',
|
|
|
|
itemsCreator: BI.emptyFn,
|
|
|
|
valueFormatter: BI.emptyFn,
|
|
|
|
el: {},
|
|
|
|
popup: {},
|
|
|
|
adapter: null,
|
|
|
|
masker: {}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
_init: function () {
|
|
|
|
BI.MultiSelectCheckSelectedSwitcher.superclass._init.apply(this, arguments);
|
|
|
|
var self = this, o = this.options;
|
|
|
|
|
|
|
|
this.button = BI.createWidget(o.el, {
|
|
|
|
type: "bi.multi_select_check_selected_button",
|
|
|
|
itemsCreator: o.itemsCreator
|
|
|
|
});
|
|
|
|
this.button.on(BI.Events.VIEW, function () {
|
|
|
|
self.fireEvent(BI.Events.VIEW, arguments);
|
|
|
|
});
|
|
|
|
this.switcher = BI.createWidget({
|
|
|
|
type: "bi.switcher",
|
|
|
|
toggle: false,
|
|
|
|
element: this,
|
|
|
|
el: this.button,
|
|
|
|
popup: BI.extend({
|
|
|
|
type: "bi.multi_select_check_pane",
|
|
|
|
valueFormatter: o.valueFormatter,
|
|
|
|
itemsCreator: o.itemsCreator,
|
|
|
|
onClickContinueSelect: function () {
|
|
|
|
self.switcher.hideView();
|
|
|
|
}
|
|
|
|
}, o.popup),
|
|
|
|
adapter: o.adapter,
|
|
|
|
masker: o.masker
|
|
|
|
});
|
|
|
|
this.switcher.on(BI.Switcher.EVENT_TRIGGER_CHANGE, function () {
|
|
|
|
self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE);
|
|
|
|
});
|
|
|
|
this.switcher.on(BI.Switcher.EVENT_BEFORE_POPUPVIEW, function () {
|
|
|
|
self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW);
|
|
|
|
});
|
|
|
|
this.switcher.on(BI.Switcher.EVENT_AFTER_POPUPVIEW, function () {
|
|
|
|
var me = this;
|
|
|
|
BI.nextTick(function () {
|
|
|
|
me.populate();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.switcher.element.click(function (e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
adjustView: function () {
|
|
|
|
this.switcher.adjustView();
|
|
|
|
},
|
|
|
|
|
|
|
|
hideView: function () {
|
|
|
|
this.switcher.empty();
|
|
|
|
this.switcher.hideView();
|
|
|
|
},
|
|
|
|
|
|
|
|
setValue: function (v) {
|
|
|
|
this.switcher.setValue(v);
|
|
|
|
},
|
|
|
|
|
|
|
|
setButtonChecked: function (v) {
|
|
|
|
this.button.setValue(v)
|
|
|
|
},
|
|
|
|
|
|
|
|
getValue: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
populate: function (items) {
|
|
|
|
this.switcher.populate.apply(this.switcher, arguments);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE = "MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE";
|
|
|
|
BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW = "MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW";
|
|
|
|
BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);
|