Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8806169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:03:53+00:00 2026-06-14T02:03:53+00:00

I have a controller that is created by the Ember.Router, and this populates a

  • 0

I have a controller that is created by the Ember.Router, and this populates a table.

The template:

{{#each key in controller}}

  {{#view App.TestView contentBinding="key"}}

  <tr {{bindAttr class="view.isSelected"}} {{action selectKey this on="click" target="view" }}>
    <td>{{key.id}}</td>
    <td><button type="button" class="btn btn-danger" {{action removeKey on="click" target="view"}}>Remove</button></td>
  </tr>

  {{/view}}

{{/each}}

The code behind:

App.TestView = Em.View.extend({
  removeKey: function () {
    var key = this.get('content');
    this.bindingContext.removeObject(key);
    return false;
  },
  selectKey: function (event) {
    this.set('theClass', 'warning');
  },
  theClass: 'selectable',
  isSelected: function () {
    return this.get('theClass');
  }.property('theClass')
});

I’m expecting the onclick event to change the class to ‘warning’, and for the row in the collection to be highlighted in yellow (as per a css class), however this does not happen. The isSelected property doesn’t seem to update the DOM, and I can’t see why it doesn’t do that.

Jsfiddle here: http://jsfiddle.net/EsF4R/114/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:03:54+00:00Added an answer on June 14, 2026 at 2:03 am

    I think there is clash between Metamorph and the table structure. Giving the tag <tr> to the view and putting the class binding on the <td> element seems to make it work, even if I think the resulting html is still weird (in particular the <script x-start> and <script x-end>)

    see your modified fiddle here: http://jsfiddle.net/Sly7/EsF4R/126/

    EDIT

    Here is a fiddle with good-looking matching tags. http://jsfiddle.net/Sly7/EsF4R/129/
    Moreover it sticks more to the behavior you want, ie handling class binding and click on the tr element instead of the td

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view controller that contains a table view, the items in the
I have a simple controller that was created through a scaffold and has a
In a word, how? I have a view controller that creates a few custom
If i have a controller action Create that returns a view with the following
I have a controller that looks like this: public class PageController : Controller {
I have a very simple MVC app at this point: Controller: public class HomeController
I have created a rails controller that returns JSON data. So, I cannot render
I have the following ember controller that is going to wait for json objects
I have an Ember application with both a view and a controller: http://jsfiddle.net/gavriguy/EDr4G/ I
I have a controller that contains an array of things. Within each of these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.