Browse Source

没写dataChange的整理下

es6
guy 3 years ago
parent
commit
c10d61889d
  1. 2
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  2. 2
      src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js
  3. 13
      src/widget/singleselect/singleselect.combo.js
  4. 10
      src/widget/singleselect/singleselect.insert.combo.js

2
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -401,7 +401,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
callback();
function adjust () {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM);
self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;

2
src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js

@ -333,7 +333,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
self._updateAllValue();
self._checkError();
if (self.wants2Quit === true) {
self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM);
self._dataChange && self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;

13
src/widget/singleselect/singleselect.combo.js

@ -64,6 +64,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.SingleSelectCombo.EVENT_STOP);
});
this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function () {
self._dataChange = true;
self.fireEvent(BI.SingleSelectCombo.EVENT_SEARCHING);
});
@ -71,6 +72,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self.storeValue = this.getValue();
assertShowValue();
self._defaultState();
self._dataChange = true;
});
this.trigger.on(BI.SingleSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
@ -95,6 +97,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
listeners: [{
eventName: BI.SingleSelectPopupView.EVENT_CHANGE,
action: function () {
self._dataChange = true;
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
@ -120,6 +123,9 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (!this.isViewVisible()) {
self._dataChange = false;// 标记数据是否发生变化
}
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
@ -133,7 +139,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM);
self._dataChange && self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM);
}
});
@ -173,7 +179,8 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
this.combo.hideView();
},
_assertValue: function (val) {},
_assertValue: function (val) {
},
_makeMap: function (values) {
return BI.makeObject(values || []);
@ -220,7 +227,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
function adjust () {
if (self.wants2Quit === true) {
self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM);
self._dataChange && self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;

10
src/widget/singleselect/singleselect.insert.combo.js

@ -75,6 +75,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
self._defaultState();
});
this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function () {
self._dataChange = true;
self.fireEvent(BI.SingleSelectInsertCombo.EVENT_SEARCHING);
});
@ -82,6 +83,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
self.storeValue = this.getValue();
assertShowValue();
self._defaultState();
self._dataChange = true;
});
this.trigger.on(BI.SingleSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
@ -106,6 +108,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
listeners: [{
eventName: BI.SingleSelectPopupView.EVENT_CHANGE,
action: function () {
self._dataChange = true;
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
@ -131,6 +134,9 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (!this.isViewVisible()) {
self._dataChange = false;// 标记数据是否发生变化
}
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
@ -144,7 +150,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM);
self._dataChange && self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM);
}
});
@ -198,7 +204,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
function adjust () {
if (self.wants2Quit === true) {
self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM);
self._dataChange && self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;

Loading…
Cancel
Save