Hi, sorry my english is not good;
I've been trying to set a default init filter on a grid for quite a few hours, and I haven't been able to. The filter type is Menu
It always returns the error "state.where.map is not a function"
***component ****
const action="/Locations/Locations";
this.filterSettings = {
type: 'Menu',
columns: [{ field: 'code', matchCase: false, operator: 'contains', predicate: 'and', value: '160' }];
}
for (var i = 0; i< this.filterSettings.columns.length; i++) {
this.predicate.push(new Predicate(
this.filterSettings.columns[i].field,
this.filterSettings.columns[i].operator,
this.filterSettings.columns[i].value,
true ))
}
let where = new Query().where(Predicate.and(this.predicate))
state = { skip: 0, take: 10, where: where.queries[0] };
this.service.execute(environment.serverUrl + this.action, state);
***service *****
...
if (state.where) {
filterQuery = `&$filter=` + state.where.map((obj: PredicateModel) => {
return (<Predicate>obj).predicates.map((predicate) => {
return predicate.operator === 'equal' ? `${predicate.field} eq ${predicate.value}` : `${predicate.operator}(tolower(${predicate.field}),'${predicate.value}')`;
}).reverse().join(' and ');
});
}
...
What am I doing wrong?
Thank you