emberx-select icon indicating copy to clipboard operation
emberx-select copied to clipboard

Doesn't work with RSVP hash

Open meliborn opened this issue 7 years ago • 6 comments

model(params){
    return Ember.RSVP.hash({
      realEstate: this.store.findRecord('realEstate', params.id, { reload: true }),
      residentialComplexes: this.store.findAll('residentialComplex'),
    });
  },
{{#x-select value=model.realEstate.residentialComplexId as |xs|}}
  <option></option>
  {{#each model.residentialComplexes as |option|}}
    {{#xs.option value=option.id}}{{option.name}}{{/xs.option}}
  {{/each}}
{{/x-select}}

It populates, but doesn't select current value. model.realEstate.residentialComplexId exist and present as an option.

meliborn avatar Feb 24 '17 15:02 meliborn

It doesn't work even if I change model.realEstate.residentialComplexId manually later.

meliborn avatar Feb 24 '17 16:02 meliborn

See #91.

{{#x-select value=model.realEstate.content as |xs|}}
	<option></option>
	{{#each model.residentialComplexes as |option|}}
	 	{{#xs.option value=option}}{{option.name}}{{/xs.option}}
	{{/each}}
{{/x-select}}

scottwernervt avatar Feb 24 '17 16:02 scottwernervt

@scottwernervt nothing happens. I thought .content for relationships.

meliborn avatar Feb 24 '17 16:02 meliborn

@meliborn I forgot to add action=(action (mut model.realEstate.residentialComplex)). I created ember-twiddle at emberx-select: Doesn't work with RSVP hash #180.

I thought .content for relationships.

I am new to Ember and Javascript so I am not sure how model.content is used. I believe it is a Ember.ObjectProxy.

scottwernervt avatar Feb 24 '17 17:02 scottwernervt

@scottwernervt thanx, but you use belongsTo, when I have issue with simple attribute. As I understood, I can't use .content with simple attributes.

meliborn avatar Feb 24 '17 22:02 meliborn

I was still able to get it to work when removing belongsTo and changing it to residentialComplexId: attr('string'), check out the updated ember-twiddle. Note the changes to {{#x-select ...}.

scottwernervt avatar Mar 03 '17 22:03 scottwernervt