Browse Source

无jira任务 修复复选下拉框分页加载情况下全选后,取消某选项,再选上该选项全选框为半选问题

es6
Aeolus.Zhang 3 years ago
parent
commit
bb24b2a5f6
  1. 19
      src/case/list/list.select.js

19
src/case/list/list.select.js

@ -93,10 +93,23 @@ BI.SelectList = BI.inherit(BI.Widget, {
var notSelectLength = this.getAllLeaves().length - selectLength; var notSelectLength = this.getAllLeaves().length - selectLength;
var hasNext = this.list.hasNext(); var hasNext = this.list.hasNext();
var isAlreadyAllSelected = this.toolbar.isSelected(); var isAlreadyAllSelected = this.toolbar.isSelected();
var isHalf = selectLength > 0 && (notSelectLength > 0 || (!isAlreadyAllSelected && hasNext)); var isHalf = selectLength > 0 && notSelectLength > 0;
isHalf = isHalf || (notSelectLength > 0 && hasNext && isAlreadyAllSelected); var allSelected = isAlreadyAllSelected;
if (this.isAllSelected() === false) {
hasNext && (isHalf = selectLength > 0);
if (!isAlreadyAllSelected && notSelectLength === 0 && !hasNext) {
allSelected = true;
}
} else {
hasNext && (isHalf = notSelectLength > 0);
if (!isAlreadyAllSelected && notSelectLength === 0) {
allSelected = true;
}
}
this.toolbar.setHalfSelected(isHalf); this.toolbar.setHalfSelected(isHalf);
!isHalf && this.toolbar.setSelected(selectLength > 0 && notSelectLength <= 0 && (!hasNext || isAlreadyAllSelected)); !isHalf && this.toolbar.setSelected(allSelected);
}, },
setAllSelected: function (v) { setAllSelected: function (v) {

Loading…
Cancel
Save