dimanche 18 décembre 2016

Iterating over object with hasMany relationship

I'm stuck trying to iterate over model object that has hasMany relationship.

Object is Question and it has many question-rows.

Inside route "grouping" I want to display all question and select one (using power select) and display table of question rows for selected question.

import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
const { RSVP } = Ember;

export default Ember.Route.extend(AuthenticatedRouteMixin, {
    selectedQuestion: null,
    model() {
        const survey = this.modelFor('survey');

        return RSVP.hash({
            questions: this.get('store').query('question', { surveyId: survey.get('id') }),
        });
    },
    actions: {
        toggleIsInversed(id) {
        }
    }
});

This is component grouping-table and it is loaded with selectedQuestion.

 
<table class="ui celled table unstackable">
    
    <thead>
        <tr>
            <th>Text</th>
            <th>Group</th>
            <th>Inverse</th>
        </tr>
    </thead>
    <tbody>
        
        <tr>
            <td></td>
            <td>Group A</td>
            <td>
                
            </td>
        </tr>
        
    </tbody>
</table>
 




Aucun commentaire:

Enregistrer un commentaire