Skip to content

Instantly share code, notes, and snippets.

@code0100fun
Last active November 14, 2018 23:14
Show Gist options
  • Save code0100fun/7a49b69049be0290b3d6dde612756d8a to your computer and use it in GitHub Desktop.
Save code0100fun/7a49b69049be0290b3d6dde612756d8a to your computer and use it in GitHub Desktop.
Large Table
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'tr',
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this._super(...arguments);
this.data = [];
for (let i = 0; i < 3000; i++) {
this.data.push({
a: 'a',
b: 'b',
c: 'c',
d: 'd',
e: 'e',
f: 'f',
g: 'g',
h: 'h',
i: 'i',
j: 'j',
k: 'k',
l: 'l',
m: 'm',
n: 'n',
o: 'o',
});
}
this.columns = Object.keys(this.data[0]);
},
});
<table>
<thead>
{{#each columns as |column|}}
<th>{{column}}</th>
{{/each}}
</thead>
<tbody>
{{#each data as |record|}}
{{component 'x-cell' record=record columns=columns}}
{{/each}}
</tbody>
</table>
{{#each columns as |column|}}
<td>{{get record column}}</td>
{{/each}}
{
"version": "0.15.1",
"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.4.6",
"ember-template-compiler": "3.4.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment