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 8084611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:51:03+00:00 2026-06-05T17:51:03+00:00

I have a view that renders a list elements using the following template :

  • 0

I have a view that renders a list elements using the following template :

   {{#each item in controller}}
       {{view App.ItemView}}        
    {{/each}}

I need the id of each item the be the id of corresponding itemView. Here is my first attempt but it doesn’t work :

App.ItemView = Ember.View.extend({
    elementId: Ember.computed(function(){
        return this.getPath('item.id');
    }),
    templateName: 'item'
});

What I’m doing wrong ?

You can find a jsfiddle illustrating my problem here http://jsfiddle.net/jrabary/vk4Ze/

  • 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-05T17:51:04+00:00Added an answer on June 5, 2026 at 5:51 pm

    At the moment the view need to compute the elementId property, item is not yet set, so here the problems are starting…

    If you want to set the id once the item is available, you will have to allow Ember to retrieve the DOM element to alter… That means Ember has to set the element’s id!
    In other words, it is impossible as of today, as Ember uses elements id to keep references on its DOM owned/controlled elements.

    Nevertheless, the view has the displayed item bound to it, so you can retrieve the item later. What is exactly you underlying need?

    EDIT

    Here is a sample customizing element’s class according to item’s id: http://jsfiddle.net/MikeAski/ZAHxm/

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

Sidebar

Related Questions

I have a View that renders a list of items, and each item contains
I have a View that renders something like this: Item 1 and Item 2
I have a partial view that renders a list of objects into a table
I have a view that creates a sub-view per item in the list. Generically
I have a function in a view that renders the xml in the browser,
I have a View that is linked to my ViewModel using a DataTemplate, like
I have a view that is instantiated in an {{#each}} block, so there are
I have a usercontrol that is rendering a list of items. Each row contains
I have a strongly typed partial view CheckBox.ascx that renders a checkbox. This is
I have the following MVC2 view that is strongly typed with a viewmodel, the

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.