Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://code.jquery.com/jquery-2.0.2.js"></script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<script src="http://builds.emberjs.com/ember-data-latest.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href=" http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"> 
</head>
<body>
  <script type="text/x-handlebars" data-template-name="index">
    {{view App.DataTableView valueBinding="data"}}
  </script>
</body>
</html>
 
window.App = Ember.Application.create();
App.Router.map(function() {
    this.route("index", {path: "/"});
});
App.IndexRoute = Ember.Route.extend({
   model: function() {
    return this.get('store').findAll('book');
  },
  setupController: function(controller, model) {
    controller.set('data', model);
  }
});
App.DataTableView =  Ember.CollectionView.extend({
  classNames:['table','table-striped','table-bordered','dataTable'],
  tagName:'table',
  didInsertElement: function(){
    if (this.get('value')){
      var data = this.get('value').getEach('data');
      this.$().dataTable({
        "bProcessing": true,
        "aaData": data,
        "aoColumns": [
          { "sTitle" : "Added", "mData": "id" },
          { "sTitle" : "Author", "mData": "author" },
          { "sTitle" : "Title", "mData": "title" },
          { "sTitle" : "Year", "mData": "year" }
        ]
      });
    }
  }
});
App.ApplicationAdapter = DS.FixtureAdapter.extend();
App.Book = DS.Model.extend({
  title: DS.attr('string'),
  author: DS.attr('string'),
  year: DS.attr('number')
});
App.Book.FIXTURES = [
    {
        id: 1,
        title: 'Freedom National: The Destruction ...',
        author:'James Oakes',
        year: 2013
    },
    {
        id: 2,
        title: 'Duke: A Life of Duke Ellington',
        author:'Terry Teachout',
        year: 2013
    },
    {
        id: 3,
        title: 'The Round House',
        author:'Louise Erdrich',
        year: 2013
    }
];
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
denispeplinpro
0viewers