emberjs/ember.js — Issue #489: collection fails to automatically update a binded attribute when it renders a tbody tag
Author: midu
Created: 2012-02-12 01:30:59+00:00
State: open

Using `{{#collection contentBinding=...}}` in a template rendered using a `tbody` tag fails to update it when the content of the controller changes.

```html

status
title
url
# messages
judging status

​
```

```javascript
var App = Em.Application.create({
ready: function () {
App.submissionsController.index();
this._super();
}
});

// model
App.Submission = Em.Object.extend({
title: null,
judgingStatus: null,
status: null,
url: null,
nbMessages: 0
});

// controller... not really.
App.submissionsController = Em.ArrayController.create({
content: [ App.Submission.create({title: 'kevin', status: 'a', judgingStatus: 'b', url: 'http://google.com', nbMessages: 1}) ],

index: function () {
// simulates data that arrives to the page after a few seconds (think ajax request)
window.setTimeout(function () {
App.submissionsController.set('content', [
App.Submission.create({title: 'stefano', status: 'c', judgingStatus: 'd', url: 'http://stackoverflow.com', nbMessages: 2})
]);
}, 2000);
}
});

Em.View.create({
templateName: 'submissions',
tagName: 'tbody'
}).appendTo('#the-table');
```
[example on jsfiddle](http://jsfiddle.net/midu/DjxG4/10/)

It does work when [using a pre tag](http://jsfiddle.net/midu/DjxG4/11/) (or anything else)

it also works [using `each`](http://jsfiddle.net/midu/DjxG4/14/)

related links:
* https://github.com/emberjs/ember.js/pull/488
* http://stackoverflow.com/questions/9234401/collection-using-contentbinding-does-not-automatically-update-when-rendering-in