I am trying the datatable jquery plugin with EMber JS. Looks like the moment Ember tries to update the DOM with some fresh data, it has a problem after datatable has styled and inserted some elements like search bar, twitter bootstrap pagination footer etc. The code is as follows
App.TableView = Em.View.extend({
classNames:['table','table-striped','table-bordered','dataTable'],
tagName:'table',
didInsertElement:function (){
this.$().dataTable({
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
});
}
});
The usage in the handlebars is as follows:
{{#view App.TableView }}
{{view App.ListStaffView}}
{{/view}}
The App.ListStaffView has the following in it
App.ListStaffView = Ember.View.extend({
templateName: 'list',
staffBinding: 'App.staffController',
showNew: function() {
this.set('isNewVisible', true);
},
hideNew: function() {
this.set('isNewVisible', false);
},
refreshListing: function() {
App.staffController.findAll();
}
});
and the list template is as follows
<thead>
<tr>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{{#each staff}}
{{view App.ShowStaffView staffBinding="this"}}
{{/each}}
</tbody>
<tfoot>
<div class="commands">
<a class="btn btn-inverse" href="#"{{action "showNew"}}>
<i class="icon-plus"></i>
</a>
<a class="btn btn-inverse" href="#"{{action "refreshListing"}}>
<i class="icon-refresh"></i>
</a>
</div>
</tfoot>
The Error after loading this is like this
Error: Cannot perform operations on a Metamorph
I did the datatable integration with zero configuration and that failed. Since Ember cannot insert data into DOM, JQuery datatable keeps saying "No data"