@mikeelemuel wrote:
Hi. I have this code that return a timeSlot record in a table and filter by
from
andzoneId
and sorted byfrom
. On,template.hbs
there is dropdown selection that would display a certain record by it’szoneID
It is working fine and i have no problem with that.However, is there any approach where i could return a record by it’s zone name? The purpose of returning a record by it’s name is because I would like to create a table that has a record of timeslot by it’s name in a different column.
My goal right now is to return something like that. When I selecte “All Zones” in a dropdown.
Here’s my code
model(params) { return this.store.query('zone', { sort: 'name' }) .then((allZones) => { const zoneId = params.zoneId || allZones.get('firstObject.id'); return Ember.RSVP.hash({ zones: allZones, zone: this.store.findRecord('zone', zoneId), timeSlots: this.store.query('timeSlot', { 'filter[from]': params.from || moment().format('YYYY-MM-DD'), 'filter[zone-id]': zoneId, 'sort': 'from' }), }); }); }
Posts: 1
Participants: 1