Browse Source

无JIRA fix: 解决复选下拉框时序不一致问题

处理思路是search_trigger调用itemsCreator时候记录op对象,multi_select_combo回调时候把op对象附加到参数列表末尾, search_trigger进行引用比较
es6
zsmj 2 years ago
parent
commit
2fa525782c
  1. 4
      src/widget/multiselect/multiselect.combo.js
  2. 4
      src/widget/multiselect/multiselect.insert.combo.js
  3. 5
      src/widget/multiselect/trigger/button.checkselected.js
  4. 10
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  5. 9
      src/widget/multiselect/trigger/searcher.multiselect.js

4
src/widget/multiselect/multiselect.combo.js

@ -284,11 +284,13 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
var self = this;
var o = this.options;
o.itemsCreator(op, function (res) {
var args = Array.prototype.slice.call(arguments);
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
args.push(op);
callback.apply(self, args);
});
},

4
src/widget/multiselect/multiselect.insert.combo.js

@ -285,11 +285,13 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
var args = Array.prototype.slice.call(arguments);
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
args.push(op);
callback.apply(self, args);
});
},

5
src/widget/multiselect/trigger/button.checkselected.js

@ -40,7 +40,7 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, {
self.numberCounter.setText(self.numberCounter.getTag());
});
this.setVisible(false);
if(BI.isNotNull(o.value)){
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
@ -51,6 +51,9 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, {
o.itemsCreator({
type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH
}, function (res) {
if (self.options.value.type !== BI.Selection.All) {
return;
}
if (BI.isNotEmptyString(res.count)) {
BI.nextTick(function () {
self.numberCounter.setText(res.count);

10
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -62,8 +62,14 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
itemsCreator: function (op, callback) {
var keyword = self.editor.getKeyword();
op.keywords = [keyword];
self.op = op;
this.setKeyword(keyword);
o.itemsCreator(op, callback);
o.itemsCreator(op, function () {
var args = Array.prototype.slice.call(arguments);
if (BI.last(args) === self.op) {
callback.apply(null, args);
}
});
},
itemHeight: o.itemHeight,
value: o.value,
@ -174,7 +180,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
}
},
getState: function() {
getState: function () {
return this.editor.getState();
},

9
src/widget/multiselect/trigger/searcher.multiselect.js

@ -51,7 +51,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
callback();
},
el: this.editor,
popup: BI.extend({
type: "bi.multi_select_search_pane",
valueFormatter: o.valueFormatter,
@ -61,7 +60,13 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
itemsCreator: function (op, callback) {
var keyword = self.editor.getValue();
op.keywords = [keyword];
o.itemsCreator(op, callback);
self.op = op;
o.itemsCreator(op, function () {
var args = Array.prototype.slice.call(arguments);
if (BI.last(args) === self.op) {
callback.apply(null, args);
}
});
},
itemHeight: o.itemHeight,
value: o.value

Loading…
Cancel
Save