Replies: 3 comments 4 replies
-
Hmm I'm not sure I understand everything, I remember that in GraphQL I needed to query with extra arguments (like a As for the If you want to add some new features to the OData Service then go ahead, you're one of the big user, on my side it's mostly plain grids (with simple JSON array) and/or GraphQL and I haven't used OData in a while. However I like to have similar features in both Services (OData/GraphQL) but I understand that there are distinction between the 2 technologies, the GraphQL Extra Arguments - Wiki was not added to the OData Service so this might be a nice addition too. As you know, I'm always very open for Contributions, as long as I can keep my 100% unit test coverage, I'm always happy to add more features 😉 |
Beta Was this translation helpful? Give feedback.
-
I started working on ^^^ and ran into a small annoying bug. When I select odata version 4 in example 9, then the response gets In <input type="radio" name="inlineRadioOptions" data-test="version4" id="radio4" value.bind="odataVersion"
onclick.delegate="setOdataVersion(4)"> 4 When selecting 4 in the UI, first the The solution is simple, just remove the |
Beta Was this translation helpful? Give feedback.
-
@ghiscoding - I did an initial commit here: https://github.com/jr01/slickgrid-universal/tree/feature/odata-select-expand - would be great to get some early feedback, but that can also wait until I submit a PR (with tests...) |
Beta Was this translation helpful? Give feedback.
-
Hey @ghiscoding,
As briefly mentioned here #578 (comment)
Imagine we have order-lines and products as entities. An order-line has an id, quantity, price and a reference/navigation to a product entity. A product has a name and a bunch of other properties. Suppose we are only interested in displaying the order-line id and the product name and we don't want to retrieve all the other properties from the backend.
Currently slickgrid-universal has no option to 1) be able to
$select
just the properties I want from the backend and 2) be able to select properties from a navigation/related entity using$expand
.To work around that I have defined the grid/columns as:
The
getODataApiCall
extends the query from slickgrid-univeral toapi/orderlines?$select=id&$expand=product($select=name)
That results in this response from the server:
{"@odata.context":"api/orderlines/$metadata#OrderLines(id,product(name)","value":[{""id":1,"product":{"name":"Cake"} ....
and the
processODataApiResponse
flattens that to[ { id: 1, 'product/name': 'Cake' }]
which slickgrid understands.The choice for
/
as a separator has benefit that filtering ($filter
) and sorting ($sort
) work out of the box. IIRC, this was a year ago, I first tried with.
but ran into issues.I haven't thought about how to integrate this into slickgrid-universal.
What do you think? If a good idea, how can this be best done?
Beta Was this translation helpful? Give feedback.
All reactions