This commit is contained in:
2021-02-03 20:12:36 +00:00
parent 95f86f7676
commit fa739dcf35

View File

@@ -371,12 +371,39 @@ export default {
CURRENTLY IN BUILDER:
editItemFilter:{ "any": true, "items": [ { "op": "=", "value": "*thisweek*", "display": "= Week - Current", "token": true }, { "op": "=", "value": "*lastmonth*", "display": "= Month - Previous", "token": true } ] }
*/
//turn activeFilter into object json.parse
from server: activefilter:{ "id": 1, "concurrency": 5029293, "userId": 1, "name": "-", "public": false, "defaultFilter": true, "listKey": "TestWidgetDataList", "filter": "[]" }
//todo: iterate this.activeFilter see if this.tableColumnData.fk is there, if it is, replace it with editItemFilter if it isn't then push it into collection
*/
console.log("BEFORE SAVE ACTIVE FILTER:", this.activeFilter);
//turn activeFilter into object json.parse
let af = JSON.parse(this.activeFilter.filter);
//remove column filter if it is already there to replace
if (af.length != 0) {
let index = af.findIndex(z => z.column == this.tableColumnData.fk);
if (index > -1) {
af.splice(index, 1);
}
}
let newColumnFilter = {
column: this.tableColumnData.fk,
any: this.editItem.filter.any,
items: []
};
this.editItem.filter.items.forEach(function(z) {
newColumnFilter.items.push({
op: z.op,
value: z.value
});
});
af.push(newColumnFilter);
//turn activeFilter back into json and send back to server to save
this.activeFilter.filter = JSON.stringify(af);
//SAVE
console.log("SAVE ACTIVE FILTER:", this.activeFilter);
this.close({ refresh: true });
},