Extjs 5 REST Many-to-Many

After creating a rest api for my data structure, I want to implement it in Extjs. After reading the documentation here and causing a search in stackoverflow and google, I still get configuration errors.

I have a recreation route that looks like this:

/api/products/:id

and each product has a set of categories that can be accessed using

/api/products/3/categories.

After creating my model for such a product:

Ext.define('Product', {
    extend: 'Ext.data.Model',
    fields: [
        'id',
        'and all the other properties here...'
    ],

    proxy: {
        type: 'rest',
        url : '/api/products'
    }
});

And, of course, do the same for categories other than this, on the route

/api/categories/:id

These models themselves DO WORK. I can create, update, read and delete a product or category without any problems.

Next, I tried to associate them with associations. There are a few things I tried, all without success:

  • Apply configs like the link says
  • ,
  • ,

, . , , google . , !

+4
1

, http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.data.proxy.Rest :

, buildUrl url Request, buildUrl. . " -" , .

, XHR XHR, , URL-. , .

0

All Articles