|
|
@ -13,6 +13,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { |
|
|
|
keywordGetter: BI.emptyFn, |
|
|
|
keywordGetter: BI.emptyFn, |
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
itemFormatter: BI.emptyFn, |
|
|
|
itemFormatter: BI.emptyFn, |
|
|
|
|
|
|
|
allowSelectAll: true, |
|
|
|
itemHeight: 24 |
|
|
|
itemHeight: 24 |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -23,7 +24,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { |
|
|
|
var self = this, opts = this.options; |
|
|
|
var self = this, opts = this.options; |
|
|
|
var hasNext = false; |
|
|
|
var hasNext = false; |
|
|
|
this.storeValue = BI.deepClone(opts.value); |
|
|
|
this.storeValue = BI.deepClone(opts.value); |
|
|
|
this.button_group = BI.createWidget({ |
|
|
|
this.button_group = BI.createWidget(opts.allowSelectAll ? { |
|
|
|
type: "bi.select_list", |
|
|
|
type: "bi.select_list", |
|
|
|
toolbar: { |
|
|
|
toolbar: { |
|
|
|
type: "bi.multi_select_bar", |
|
|
|
type: "bi.multi_select_bar", |
|
|
@ -83,13 +84,65 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { |
|
|
|
hasNext: function () { |
|
|
|
hasNext: function () { |
|
|
|
return hasNext; |
|
|
|
return hasNext; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} : { |
|
|
|
|
|
|
|
type: "bi.list_pane", |
|
|
|
|
|
|
|
logic: { |
|
|
|
|
|
|
|
dynamic: true, |
|
|
|
|
|
|
|
innerVgap: 5, |
|
|
|
|
|
|
|
rowSize: ["", "fill"], |
|
|
|
|
|
|
|
verticalAlign: BI.VerticalAlign.Stretch |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
element: this, |
|
|
|
|
|
|
|
el: { |
|
|
|
|
|
|
|
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, |
|
|
|
|
|
|
|
behaviors: { |
|
|
|
|
|
|
|
redmark: function () { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
layouts: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: "bi.vertical" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
itemsCreator: function (op, callback) { |
|
|
|
|
|
|
|
self.storeValue && (op = BI.extend(op || {}, { |
|
|
|
|
|
|
|
selectedValues: self.storeValue.value |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
opts.itemsCreator(op, function (ob) { |
|
|
|
|
|
|
|
var keyword = ob.keyword = opts.keywordGetter(); |
|
|
|
|
|
|
|
hasNext = ob.hasNext; |
|
|
|
|
|
|
|
var firstItems = []; |
|
|
|
|
|
|
|
if (op.times === 1 && self.storeValue) { |
|
|
|
|
|
|
|
var json = self._filterValues(self.storeValue); |
|
|
|
|
|
|
|
firstItems = self._createItems(json); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var context = { |
|
|
|
|
|
|
|
tipText: ob.tipText, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
callback(firstItems.concat(self._createItems(ob.items)), keyword, context); |
|
|
|
|
|
|
|
if (op.times === 1 && self.storeValue) { |
|
|
|
|
|
|
|
self.setValue(self.storeValue); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
value: opts.value, |
|
|
|
|
|
|
|
height: "fill", |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { |
|
|
|
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { |
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { |
|
|
|
if (opts.allowSelectAll) { |
|
|
|
self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); |
|
|
|
this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { |
|
|
|
}); |
|
|
|
self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.button_group.on(BI.ListPane.EVENT_CHANGE, function (val) { |
|
|
|
|
|
|
|
self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, val); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_createItems: function (items) { |
|
|
|
_createItems: function (items) { |
|
|
@ -113,7 +166,8 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isAllSelected: function () { |
|
|
|
isAllSelected: function () { |
|
|
|
return this.button_group.isAllSelected(); |
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
return o.allowSelectAll ? this.button_group.isAllSelected() : false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_filterValues: function (src) { |
|
|
|
_filterValues: function (src) { |
|
|
|