feat:过滤行没有数据的时候不执行回调、清除值只清空存在的值,不多次回调
This commit is contained in:
parent
91ba29f52f
commit
6cccb5c40a
|
@ -59,7 +59,6 @@ var FilterDropDown = function (_Component) {
|
||||||
_this.onSelectDropdown = function (item) {
|
_this.onSelectDropdown = function (item) {
|
||||||
var _this$props = _this.props,
|
var _this$props = _this.props,
|
||||||
onSelectDropdown = _this$props.onSelectDropdown,
|
onSelectDropdown = _this$props.onSelectDropdown,
|
||||||
dataText = _this$props.dataText,
|
|
||||||
filterDropdownType = _this$props.filterDropdownType;
|
filterDropdownType = _this$props.filterDropdownType;
|
||||||
|
|
||||||
if (onSelectDropdown) {
|
if (onSelectDropdown) {
|
||||||
|
|
|
@ -68,13 +68,15 @@ var FilterType = function (_Component) {
|
||||||
onFilterClear = _this$props.onFilterClear,
|
onFilterClear = _this$props.onFilterClear,
|
||||||
dataIndex = _this$props.dataIndex;
|
dataIndex = _this$props.dataIndex;
|
||||||
|
|
||||||
_this.setState({
|
if (_this.state.value !== "") {
|
||||||
value: "", //清空值
|
_this.setState({
|
||||||
condition: _this.props.filterDropdownType == 'string' ? 'LIKE' : 'EQ' //切回默认查询条件
|
value: "", //清空值
|
||||||
}, function () {
|
condition: _this.props.filterDropdownType == 'string' ? 'LIKE' : 'EQ' //切回默认查询条件
|
||||||
//调用清除方法参数为当前字段的field
|
}, function () {
|
||||||
onFilterClear && onFilterClear(dataIndex);
|
//调用清除方法参数为当前字段的field
|
||||||
});
|
onFilterClear && onFilterClear(dataIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_this.changeText = function (val) {
|
_this.changeText = function (val) {
|
||||||
|
@ -89,7 +91,7 @@ var FilterType = function (_Component) {
|
||||||
dataIndex = _this$props2.dataIndex;
|
dataIndex = _this$props2.dataIndex;
|
||||||
|
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
onFilterChange(dataIndex, e.target.value, _this.state.condition);
|
e.target.value !== "" && onFilterChange(dataIndex, e.target.value, _this.state.condition);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,7 +109,7 @@ var FilterType = function (_Component) {
|
||||||
_this.setState({
|
_this.setState({
|
||||||
condition: item.key
|
condition: item.key
|
||||||
}, function () {
|
}, function () {
|
||||||
onFilterChange && onFilterChange(dataIndex, _this.state.value, _this.state.condition);
|
_this.state.value !== "" && onFilterChange && onFilterChange(dataIndex, _this.state.value, _this.state.condition);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,8 @@ var TableHeader = function (_Component) {
|
||||||
rendertype: type,
|
rendertype: type,
|
||||||
className: clsPrefix + " filter-dropdown",
|
className: clsPrefix + " filter-dropdown",
|
||||||
data: selectDataSource,
|
data: selectDataSource,
|
||||||
dataIndex: dataIndex //字段
|
notFoundContent: "Loading" //没有数据显示的默认字
|
||||||
|
, dataIndex: dataIndex //字段
|
||||||
, onFilterChange: _this.handlerFilterChange //输入框回调
|
, onFilterChange: _this.handlerFilterChange //输入框回调
|
||||||
, onFilterClear: _this.handlerFilterClear //清除回调
|
, onFilterClear: _this.handlerFilterClear //清除回调
|
||||||
, filterDropdown: rows[1][index]["filterdropdown"],
|
, filterDropdown: rows[1][index]["filterdropdown"],
|
||||||
|
|
|
@ -13079,7 +13079,8 @@
|
||||||
rendertype: type,
|
rendertype: type,
|
||||||
className: clsPrefix + " filter-dropdown",
|
className: clsPrefix + " filter-dropdown",
|
||||||
data: selectDataSource,
|
data: selectDataSource,
|
||||||
dataIndex: dataIndex //字段
|
notFoundContent: "Loading" //没有数据显示的默认字
|
||||||
|
, dataIndex: dataIndex //字段
|
||||||
, onFilterChange: _this.handlerFilterChange //输入框回调
|
, onFilterChange: _this.handlerFilterChange //输入框回调
|
||||||
, onFilterClear: _this.handlerFilterClear //清除回调
|
, onFilterClear: _this.handlerFilterClear //清除回调
|
||||||
, filterDropdown: rows[1][index]["filterdropdown"],
|
, filterDropdown: rows[1][index]["filterdropdown"],
|
||||||
|
@ -14362,13 +14363,15 @@
|
||||||
onFilterClear = _this$props.onFilterClear,
|
onFilterClear = _this$props.onFilterClear,
|
||||||
dataIndex = _this$props.dataIndex;
|
dataIndex = _this$props.dataIndex;
|
||||||
|
|
||||||
_this.setState({
|
if (_this.state.value !== "") {
|
||||||
value: "", //清空值
|
_this.setState({
|
||||||
condition: _this.props.filterDropdownType == 'string' ? 'LIKE' : 'EQ' //切回默认查询条件
|
value: "", //清空值
|
||||||
}, function () {
|
condition: _this.props.filterDropdownType == 'string' ? 'LIKE' : 'EQ' //切回默认查询条件
|
||||||
//调用清除方法参数为当前字段的field
|
}, function () {
|
||||||
onFilterClear && onFilterClear(dataIndex);
|
//调用清除方法参数为当前字段的field
|
||||||
});
|
onFilterClear && onFilterClear(dataIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_this.changeText = function (val) {
|
_this.changeText = function (val) {
|
||||||
|
@ -14383,7 +14386,7 @@
|
||||||
dataIndex = _this$props2.dataIndex;
|
dataIndex = _this$props2.dataIndex;
|
||||||
|
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
onFilterChange(dataIndex, e.target.value, _this.state.condition);
|
e.target.value !== "" && onFilterChange(dataIndex, e.target.value, _this.state.condition);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14401,7 +14404,7 @@
|
||||||
_this.setState({
|
_this.setState({
|
||||||
condition: item.key
|
condition: item.key
|
||||||
}, function () {
|
}, function () {
|
||||||
onFilterChange && onFilterChange(dataIndex, _this.state.value, _this.state.condition);
|
_this.state.value !== "" && onFilterChange && onFilterChange(dataIndex, _this.state.value, _this.state.condition);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52530,7 +52533,6 @@
|
||||||
_this.onSelectDropdown = function (item) {
|
_this.onSelectDropdown = function (item) {
|
||||||
var _this$props = _this.props,
|
var _this$props = _this.props,
|
||||||
onSelectDropdown = _this$props.onSelectDropdown,
|
onSelectDropdown = _this$props.onSelectDropdown,
|
||||||
dataText = _this$props.dataText,
|
|
||||||
filterDropdownType = _this$props.filterDropdownType;
|
filterDropdownType = _this$props.filterDropdownType;
|
||||||
|
|
||||||
if (onSelectDropdown) {
|
if (onSelectDropdown) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27,7 +27,7 @@ class FilterDropDown extends Component {
|
||||||
* @param {*} s 选中的selectRecord
|
* @param {*} s 选中的selectRecord
|
||||||
*/
|
*/
|
||||||
onSelectDropdown = (item) => {
|
onSelectDropdown = (item) => {
|
||||||
let { onSelectDropdown, dataText, filterDropdownType } = this.props;
|
let { onSelectDropdown, filterDropdownType } = this.props;
|
||||||
if (onSelectDropdown) {
|
if (onSelectDropdown) {
|
||||||
if (filterDropdownType == 'string') {
|
if (filterDropdownType == 'string') {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -33,13 +33,15 @@ class FilterType extends Component {
|
||||||
*/
|
*/
|
||||||
clearFilter = () => {
|
clearFilter = () => {
|
||||||
let { onFilterClear, dataIndex } = this.props;
|
let { onFilterClear, dataIndex } = this.props;
|
||||||
this.setState({
|
if (this.state.value !== "") {
|
||||||
value: "",//清空值
|
this.setState({
|
||||||
condition: this.props.filterDropdownType == 'string' ? 'LIKE' : 'EQ'//切回默认查询条件
|
value: "",//清空值
|
||||||
}, () => {
|
condition: this.props.filterDropdownType == 'string' ? 'LIKE' : 'EQ'//切回默认查询条件
|
||||||
//调用清除方法参数为当前字段的field
|
}, () => {
|
||||||
onFilterClear && onFilterClear(dataIndex);
|
//调用清除方法参数为当前字段的field
|
||||||
});
|
onFilterClear && onFilterClear(dataIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +61,7 @@ class FilterType extends Component {
|
||||||
changeTextCall = (e) => {
|
changeTextCall = (e) => {
|
||||||
let { onFilterChange, dataIndex } = this.props;
|
let { onFilterChange, dataIndex } = this.props;
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
onFilterChange(dataIndex, e.target.value, this.state.condition);
|
e.target.value !== "" && onFilterChange(dataIndex, e.target.value, this.state.condition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +84,7 @@ class FilterType extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
condition: item.key
|
condition: item.key
|
||||||
}, () => {
|
}, () => {
|
||||||
onFilterChange && onFilterChange(dataIndex, this.state.value, this.state.condition);
|
this.state.value !== "" && onFilterChange && onFilterChange(dataIndex, this.state.value, this.state.condition);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -445,6 +445,7 @@ class TableHeader extends Component {
|
||||||
rendertype={type}
|
rendertype={type}
|
||||||
className={`${clsPrefix} filter-dropdown`}
|
className={`${clsPrefix} filter-dropdown`}
|
||||||
data={selectDataSource}
|
data={selectDataSource}
|
||||||
|
notFoundContent={"Loading"}//没有数据显示的默认字
|
||||||
dataIndex={dataIndex}//字段
|
dataIndex={dataIndex}//字段
|
||||||
onFilterChange={this.handlerFilterChange}//输入框回调
|
onFilterChange={this.handlerFilterChange}//输入框回调
|
||||||
onFilterClear={this.handlerFilterClear}//清除回调
|
onFilterClear={this.handlerFilterClear}//清除回调
|
||||||
|
|
Loading…
Reference in New Issue