Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

View logic in DS Models?

$
0
0

@localyost wrote:

Hi everybody,

I fear I already know the answer to this but I thought I’d put it out there.

I have some DS.Models that are displayed on one side as RowComponent in a TableComponent and in as MarkerComponent in a MapComponent on the other.

When the User selects a RowComponent, the MarkerComponent of the same Record should be aware of it and vice versa.

I am flirting with the idea of adding isSelected: DS.attr('boolean') to my Models and observing it.

//  RowComponent
click(){
     // set a select styling
     this.get('record').set('isSelected',  true);
}

// in MarkerComponent
listenForDistantSelect: function(){
   // set a select styling
}.observes('record.isSelected')

It’s not really business logic, which as I understand should be reserved to Routes and EmberData stuff. Would you say this is something that should really handled at the View level or has anyone done somthing similar?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles