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.
67 lines
1.8 KiB
67 lines
1.8 KiB
8 years ago
|
/**
|
||
|
* Created by GUY on 2016/1/26.
|
||
|
*
|
||
|
* @class BI.MultiLayerSingleTreePopup
|
||
|
* @extends BI.Pane
|
||
|
*/
|
||
|
|
||
|
BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
|
||
|
|
||
|
_defaultConfig: function () {
|
||
|
return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
|
||
|
baseCls: "bi-multilayer-singletree-popup",
|
||
|
tipText: BI.i18nText("BI-No_Selected_Item"),
|
||
|
isDefaultInit: false,
|
||
|
itemsCreator: BI.emptyFn,
|
||
|
items: []
|
||
|
});
|
||
|
},
|
||
|
|
||
|
_init: function () {
|
||
|
BI.MultiLayerSingleTreePopup.superclass._init.apply(this, arguments);
|
||
|
|
||
|
var self = this, o = this.options;
|
||
|
|
||
|
this.tree = BI.createWidget({
|
||
|
type: 'bi.multilayer_single_level_tree',
|
||
|
isDefaultInit: o.isDefaultInit,
|
||
|
items: o.items,
|
||
|
itemsCreator: o.itemsCreator
|
||
|
});
|
||
|
|
||
|
BI.createWidget({
|
||
|
type: "bi.vertical",
|
||
|
scrolly: false,
|
||
|
scrollable: true,
|
||
|
element: this,
|
||
|
items: [this.tree]
|
||
|
});
|
||
|
|
||
|
this.tree.on(BI.Controller.EVENT_CHANGE, function () {
|
||
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
|
||
|
});
|
||
|
|
||
|
this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () {
|
||
|
self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE);
|
||
|
});
|
||
|
|
||
|
this.check();
|
||
|
},
|
||
|
|
||
|
getValue: function () {
|
||
|
return this.tree.getValue();
|
||
|
},
|
||
|
|
||
|
setValue: function (v) {
|
||
|
v = BI.isArray(v) ? v : [v];
|
||
|
this.tree.setValue(v);
|
||
|
},
|
||
|
|
||
|
populate: function (items) {
|
||
|
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
|
||
|
this.tree.populate(items);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
|
||
|
$.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);
|