Skip to content

Instantly share code, notes, and snippets.

@vigneshrajarr
Created August 14, 2018 19:49
Show Gist options
  • Save vigneshrajarr/ca5d370f227ae8d47e8c986218fff51d to your computer and use it in GitHub Desktop.
Save vigneshrajarr/ca5d370f227ae8d47e8c986218fff51d to your computer and use it in GitHub Desktop.
Ember Table
import Ember from 'ember';
export default Ember.Controller.extend({
headings:function(){
return Object.keys(this.get('information'));
}.property("information"),
information: function(){
return [["Row1-Col1-1","Row1-Col2-1","Row1-Col3-1","Row1-Col4-1","Row1-Col5-1"],
["Row2-Col1-2","Row2-Col2-2","Row2-Col3-2","Row2-Col4-2","Row2-Col5-2"],
["Row3-Col1-3","Row3-Col2-3","Row3-Col3-3","Row3-Col4-3","Row3-Col5-3"],
["Row4-Col1-4","Row4-Col2-4","Row4-Col3-4","Row4-Col4-4","Row4-Col5-4"],
["Row5-Col1-5","Row5-Col2-5","Row5-Col3-5","Row5-Col4-5","Row5-Col5-5"]]
}.property(),
actions:{
toggleColour : function(columnid){
}
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
table, th, tr, td
{
border: 1px solid black;
}
<h1>Table</h1>
<br>
<br>
<table>
<th>
{{#each headings as |heading|}}
<td>{{heading}}</td>
{{/each}}
</th>
{{#each information as |row|}}
<tr>
{{#each row as |column|}}
<td>{{column}}</td>
{{/each}}
</tr>
{{/each}}
</table>
<br>
<br>
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2"
},
"addons": {
"ember-data": "3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment