Browse Source

feature: 选中数据支持分页

es6
guy 2 years ago
parent
commit
7def0a8f81
  1. 6
      src/base/combination/group.button.js
  2. 12
      src/case/layer/pane.list.js
  3. 10
      src/case/list/list.select.js
  4. 5
      src/widget/multiselect/loader.js

6
src/base/combination/group.button.js

@ -244,6 +244,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}); });
}, },
setAllSelected: function (v) {
BI.each(this.getAllButtons(), function (i, btn) {
(btn.setSelected || btn.setAllSelected).apply(btn, [v]);
});
},
getNotSelectedValue: function () { getNotSelectedValue: function () {
var v = []; var v = [];
BI.each(this.buttons, function (i, item) { BI.each(this.buttons, function (i, item) {

12
src/case/layer/pane.list.js

@ -150,6 +150,16 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.button_group.setValue.apply(this.button_group, arguments); this.button_group.setValue.apply(this.button_group, arguments);
}, },
setAllSelected: function (v) {
if (this.button_group.setAllSelected) {
this.button_group.setAllSelected(v);
} else {
BI.each(this.getAllButtons(), function (i, btn) {
(btn.setSelected || btn.setAllSelected).apply(btn, [v]);
});
}
},
getValue: function () { getValue: function () {
return this.button_group.getValue.apply(this.button_group, arguments); return this.button_group.getValue.apply(this.button_group, arguments);
}, },
@ -183,4 +193,4 @@ BI.ListPane = BI.inherit(BI.Pane, {
} }
}); });
BI.ListPane.EVENT_CHANGE = "EVENT_CHANGE"; BI.ListPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.list_pane", BI.ListPane); BI.shortcut("bi.list_pane", BI.ListPane);

10
src/case/list/list.select.js

@ -113,9 +113,13 @@ BI.SelectList = BI.inherit(BI.Widget, {
}, },
setAllSelected: function (v) { setAllSelected: function (v) {
BI.each(this.getAllButtons(), function (i, btn) { if (this.list.setAllSelected) {
(btn.setSelected || btn.setAllSelected).apply(btn, [v]); this.list.setAllSelected(v);
}); } else {
BI.each(this.getAllButtons(), function (i, btn) {
(btn.setSelected || btn.setAllSelected).apply(btn, [v]);
});
}
this.allSelected = !!v; this.allSelected = !!v;
this.toolbar.setSelected(v); this.toolbar.setSelected(v);
this.toolbar.setHalfSelected(false); this.toolbar.setHalfSelected(false);

5
src/widget/multiselect/loader.js

@ -204,6 +204,11 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
return this.cachGroup.getNotSelectedValue(); return this.cachGroup.getNotSelectedValue();
}, },
setAllSelected: function (v) {
this.button_group.setAllSelected(v);
this.cachGroup.setAllSelected(v);
},
setValue: function (value) { setValue: function (value) {
var map = BI.makeObject(value); var map = BI.makeObject(value);
this.cachGroup.setValueMap.call(this.cachGroup, map); this.cachGroup.setValueMap.call(this.cachGroup, map);

Loading…
Cancel
Save