After building a rest api for my data structure, I want to implement it into Extjs. After reading the documentations here and ofcourse searching on stackoverflow and google, i still get errors when setting it up.
I have a rest route that looks like this:
/api/products/:id
and each product has a collection of categories that can be accessed using
/api/products/3/categories.
After creating my model for the product like so:
Ext.define('Product', {
extend: 'Ext.data.Model',
fields: [
'id',
'and all the other properties here...'
],
proxy: {
type: 'rest',
url : '/api/products'
}
});
And ofcourse doing the same for the categories, exept then to the route
/api/categories/:id
These models on their own DO WORK. I can create, update, read and delete a product or category without any trouble.
Next up i tried to make the associations to properly link them. there are a few things i have tried, all without any success:
- Apply configs like this link says
- Apply configs like another link says
- Create an own custom proxy like explained here
Either the result does nothing, or creates an empty association store with no model. I have no clue what I'm doing wrong, and most info on google is highly outdated. PLEASE HELP!
Thanks in advance
/api/categories
, how can you expect product's cats to be loaded from/api/products/3/categories
? – Greendrake