|
楼主 |
发表于 2019-10-11 22:26:45
|
显示全部楼层
GridFiter设置多选默认值时有bug,这是gridFilter.js中的代码:
getFilterStr : function() {
var bizData = this.getFilterData();
var relation = bizData.defCols[this.filterCol].relation;
var values = this.selectedValue.get() || this.getDefaultValue();
var gridSelect = this.getGridSelect();
var multiSelect = gridSelect.optionCfg.multiselect;
var separator = gridSelect.valueSeparator;
if (!values || $.trim(values) === "") {
return "";
}
separator = separator ? separator : ",";
if (typeof(values) == "string") {
if (multiSelect) {
values = values.split(separator);
} else {
values = [values];
}
}
var filters = [];
$.each(values, function(i, value) {
value = value.replace(/'/g, "''");
filters.push(relation + "='" + value + "'");
});
return "(" + filters.join(") OR (") + ")";
}
注意这一行:var multiSelect = gridSelect.optionCfg.multiselect,下拉框没下拉时,multiSelect始终为空值(可参考gridSelect.js中的代码)。所以,不会把默认值拆分为多个过滤条件。 |
|