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.

75 lines
2.3 KiB

8 years ago
/**
* guy
* 复选框item
* @type {*|void|Object}
*/
BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
8 years ago
_defaultConfig: function () {
8 years ago
return BI.extend(BI.MultiSelectItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-multi-select-item",
height: 25,
logic: {
dynamic: false
}
})
},
8 years ago
_init: function () {
8 years ago
BI.MultiSelectItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.checkbox"
});
this.text = BI.createWidget({
type: "bi.label",
cls: "list-item-text",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
rgap: o.rgap,
text: o.text,
keyword: o.keyword,
value: o.value,
py: o.py
});
8 years ago
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
8 years ago
self.setSelected(self.isSelected());
}
});
BI.createWidget(BI.extend({
8 years ago
element: this
8 years ago
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt",
items: [this.checkbox],
width: 36
8 years ago
}, this.text)
8 years ago
}))));
},
8 years ago
doRedMark: function () {
8 years ago
this.text.doRedMark.apply(this.text, arguments);
},
8 years ago
unRedMark: function () {
8 years ago
this.text.unRedMark.apply(this.text, arguments);
},
8 years ago
doClick: function () {
8 years ago
BI.MultiSelectItem.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected());
8 years ago
if (this.isValid()) {
this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this);
}
8 years ago
},
8 years ago
setSelected: function (v) {
8 years ago
BI.MultiSelectItem.superclass.setSelected.apply(this, arguments);
this.checkbox.setSelected(v);
}
});
BI.MultiSelectItem.EVENT_CHANGE = "EVENT_CHANGE";
8 years ago
BI.shortcut("bi.multi_select_item", BI.MultiSelectItem);