vendredi 3 novembre 2017

Ember.js - Matching model data and has many relationship in controller

I'm trying to build a table component that displays all matching data. I don't know how to get this working.

I have multiple Platforms that have many Markets.

The model is easy:

model() {
  return this.store.findAll('platform', {include: 'markets'});
}

I can display check boxes so the user can select what platforms to compare and access the id's in the controller.

How do I go about getting the correct records from the model in the controller? I can't do this in the route because it depends on what platforms are selected.

I can use Ember Data:

this.get('store').findRecord('platform', id, {include: 'markets'})

But I can't figure out how to access the markets.

I tried enumerables also, but the same issue:

this.get('model').filterBy('id', id)

After this, what is a clean way to get the matching markets based on their name?




Aucun commentaire:

Enregistrer un commentaire