Filtering nested / complex data binding generates inaccurate ODataV4 query
Hey team!
Assuming a simple grid with a nested / complex data binding (somethingExpanded.detail in this excerpt):
<template>
<div id="app">
<ejs-grid :dataSource='data' :query='query' :allowFiltering='true' :filterSettings='filterSettings'>
<e-columns>
<e-column field='id' headerText='An ID' textAlign='Right' width=100></e-column>
<e-column field='somethingExpanded.detail' headerText='Expanded detail' width=120></e-column>
</e-columns>
</ejs-grid>
</div>
</template>Using the query expand to join a column, and a Menu type filter:
<script>
import Vue from "vue";
import { GridPlugin, Filter } from "@syncfusion/ej2-vue-grids";
Vue.use(GridPlugin);
export default {
data() {
return {
data: anODataV4Source,
query: new Query().expand(['somethingExpanded'])
filterSettings: {
type: 'Menu',
ignoreAccent: true,
columns: [
{
field: 'somethingExpanded.detail',
operator: 'equal',
predicate: 'and',
matchCase: true,
value: 'whatever',
}
],
}
};
},
provide: {
grid: [Filter]
}
}
</script>The ODataV4 source is working exactly as expected and the somethingExpanded table is appropriately added as $expand: somethingExpanded and accurately left joined by the server.
Yet, the generated filter query is not a valid ODataV4 one as it becomes: $filter: (somethingExpandeddetail eq 'whatever') instead of $filter: (somethingExpanded/detail eq 'whatever') (notice the slash / between somethingExpanded and detail, the nested field).
If I intercept the query server side, and string replace "somethingExpandeddetail" to "somethingExpanded/detail" then the query works exactly as expected.
Here is the question: did I miss something in the frontend grid configuration that leads me there? Or do you think that just looks like a bug in the underlying query building process?
Thanks for your help!
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
MS
Manivel Sellamuthu
Syncfusion Team
December 16, 2020 07:31 PM UTC
Hi Peter,
Greetings from Syncfusion support.
We have tried to replicate the reported issue at our end. It is working fine at our end. The below screenshot is Filtered response of an OdataV4 adaptor with the complex / nested filter.
Could you please share the below details, which will be helpful for us to validate further about issue.
- Share the complete Grid code
- Screenshot or video demo of the issue
Regards,
Manivel
PE
Peter
January 23, 2021 08:58 AM UTC
Thanks Manivel!
I'm afraid that one is on me 😳 Forgot that we have a:
class CustomODataV4Adaptor extends ODataV4Adaptor
Its purpose is to remove the trailing slash from the url pathname, which is somehow added as mentioned in some other threads in this forum. This class, that we wrote, was faulty and leading to the issue. My apologies about that!
✅ Not a bug!
Marked as answer
MS
Manivel Sellamuthu
Syncfusion Team
January 25, 2021 06:53 AM UTC
Hi Peter,
Thanks for your update.
Please let us know, if you need further assistance.
Regards,
Manivel
SIGN IN To post a reply.