You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on creating a style for the BackAnd API Style and I'm running into an issue on how it returns collections on requests. Is there a way to config the BelongsToMany/HasMany (or attrAsReferenceToMany) reader for all restmod 'HasMany'-like model references?
The default is to read from an array like: [2,4]
But the references I get come in a comma delimited string like this: "2,4"
I've already setup to read from 'data', but I need some pointers on setting up
You can add computed function first on the AssociatedData element which can explode comma separated ids into an array. Once it is done then beongsToMany relationship will load its references from related data element. I know it is late but if you are still in need of the answer. I can share the code if you need it to do so.
I'm working on creating a style for the BackAnd API Style and I'm running into an issue on how it returns collections on requests. Is there a way to config the BelongsToMany/HasMany (or attrAsReferenceToMany) reader for all restmod 'HasMany'-like model references?
The default is to read from an array like:
[2,4]
But the references I get come in a comma delimited string like this:
"2,4"
I've already setup to read from 'data', but I need some pointers on setting up
Example:
{ "totalRows": 1, "data": [ { "id": 3, "AssociatedData": "4,2", "name": "TestName" } ] }
Model Definition:
return restmod.model('/MyObjects').mix({ AssociatedData: { belongsToMany: 'MyObject', keys: 'AssociatedData' } });
The text was updated successfully, but these errors were encountered: