Browse Source

BI-115201 fix: 【6.0.3.3】下拉树下拉后不选择任何内容,前端多发一个data请求

es6
zsmj 2 years ago
parent
commit
a7a9ac9429
  1. 12
      demo/js/widget/multitree/demo.multi_tree_combo.js
  2. 10
      src/widget/multitree/multi.tree.combo.js
  3. 11
      src/widget/multitree/multi.tree.insert.combo.js

12
demo/js/widget/multitree/demo.multi_tree_combo.js

@ -38,7 +38,15 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, {
width: 300, width: 300,
value: { value: {
"根目录": {} "根目录": {}
} },
listeners: [
{
eventName: "EVENT_CONFIRM",
action: function () {
console.log("EVENT_CONFIRM", this.getValue());
}
}
]
}, { }, {
type: "bi.button", type: "bi.button",
text: "getValue", text: "getValue",
@ -52,4 +60,4 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo); BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo);

10
src/widget/multitree/multi.tree.combo.js

@ -82,6 +82,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() }; self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue());
self._dataChange = true;
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
@ -92,6 +93,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () { action: function () {
clear = true; clear = true;
self._dataChange = true;
self.setValue(); self.setValue();
self._defaultState(); self._defaultState();
} }
@ -180,12 +182,16 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue());
self._dataChange = true;
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
return; return;
} }
if (!this.isViewVisible()) {
self._dataChange = false; // 标记数据是否发生变化
}
if (change === true) { if (change === true) {
self.storeValue = { value: self.combo.getValue() }; self.storeValue = { value: self.combo.getValue() };
change = false; change = false;
@ -198,7 +204,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
if (isSearching()) { if (isSearching()) {
self._stopEditing(); self._stopEditing();
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
} else { } else {
if (isPopupView()) { if (isPopupView()) {
self._stopEditing(); self._stopEditing();
@ -206,7 +212,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
if (clear === true) { if (clear === true) {
self.storeValue = { value: {} }; self.storeValue = { value: {} };
} }
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
} }
} }
clear = false; clear = false;

11
src/widget/multitree/multi.tree.insert.combo.js

@ -56,6 +56,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
self._stopEditing(); self._stopEditing();
self._dataChange = true;
} }
}] }]
} }
@ -99,6 +100,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() }; self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue()); self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue());
self._dataChange = true;
} }
}, { }, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
@ -109,6 +111,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () { action: function () {
clear = true; clear = true;
self._dataChange = true;
self.setValue(); self.setValue();
self._defaultState(); self._defaultState();
} }
@ -192,12 +195,16 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue()); self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue());
self._dataChange = true;
}); });
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
return; return;
} }
if (!this.isViewVisible()) {
self._dataChange = false; // 标记数据是否发生变化
}
if (change === true) { if (change === true) {
self.storeValue = { value: self.combo.getValue() }; self.storeValue = { value: self.combo.getValue() };
change = false; change = false;
@ -210,7 +217,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
if (isSearching()) { if (isSearching()) {
self._stopEditing(); self._stopEditing();
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM);
} else { } else {
if (isPopupView()) { if (isPopupView()) {
self._stopEditing(); self._stopEditing();
@ -218,7 +225,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
if (clear === true) { if (clear === true) {
self.storeValue = { value: {} }; self.storeValue = { value: {} };
} }
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); self._dataChange && self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM);
} }
} }
clear = false; clear = false;

Loading…
Cancel
Save