This commit is contained in:
@@ -371,12 +371,39 @@ export default {
|
|||||||
CURRENTLY IN BUILDER:
|
CURRENTLY IN BUILDER:
|
||||||
editItemFilter:{ "any": true, "items": [ { "op": "=", "value": "*thisweek*", "display": "= Week - Current", "token": true }, { "op": "=", "value": "*lastmonth*", "display": "= Month - Previous", "token": true } ] }
|
editItemFilter:{ "any": true, "items": [ { "op": "=", "value": "*thisweek*", "display": "= Week - Current", "token": true }, { "op": "=", "value": "*lastmonth*", "display": "= Month - Previous", "token": true } ] }
|
||||||
|
|
||||||
*/
|
from server: activefilter:{ "id": 1, "concurrency": 5029293, "userId": 1, "name": "-", "public": false, "defaultFilter": true, "listKey": "TestWidgetDataList", "filter": "[]" }
|
||||||
//turn activeFilter into object json.parse
|
|
||||||
|
|
||||||
//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
|
//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 });
|
this.close({ refresh: true });
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user