yeah, it is not supported query.filter() has an alternative format:
query.filter('it.something == this.something')
so with some string concat can achieve what you want
query.filter('it.'+field+' == this.value', { value: 'Lea'})
Question
Example of what I'd love to be able to do:
query.filter(function (person) {
return person[this.field] == this.value;
}, {
field: 'FirstName',
value: 'Lea'
});
This throws an exception as of JayData 1.3.2.
Note that hard-coding the property name with []
syntax works as expected (although not useful):
query.filter(function (person) {
return person['FirstName'] == this.value;
}, {
value: 'Lea'
});
Note: Using the OData provider, if that matters.
Solution
yeah, it is not supported query.filter() has an alternative format:
query.filter('it.something == this.something')
so with some string concat can achieve what you want
query.filter('it.'+field+' == this.value', { value: 'Lea'})