Commit ba3315a7 authored by lirilsu's avatar lirilsu Committed by 杨奕

Table: Filter data again when change data

parent cb993a64
...@@ -85,6 +85,19 @@ TableStore.prototype.mutations = { ...@@ -85,6 +85,19 @@ TableStore.prototype.mutations = {
setData(states, data) { setData(states, data) {
const dataInstanceChanged = states._data !== data; const dataInstanceChanged = states._data !== data;
states._data = data; states._data = data;
Object.keys(states.filters).forEach((columnId) => {
const values = states.filters[columnId];
if (!values || values.length === 0) return;
const column = getColumnById(this.states, columnId);
if (column && column.filterMethod) {
data = data.filter((row) => {
return values.some(value => column.filterMethod.call(null, value, row));
});
}
});
states.filteredData = data;
states.data = sortData((data || []), states); states.data = sortData((data || []), states);
// states.data.forEach((item) => { // states.data.forEach((item) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment