Skip to content

Instantly share code, notes, and snippets.

@Techn1x
Forked from RustyToms/components.expandable-table.js
Last active November 10, 2017 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Techn1x/f8bba289730a0caba2cf416141c13199 to your computer and use it in GitHub Desktop.
Save Techn1x/f8bba289730a0caba2cf416141c13199 to your computer and use it in GitHub Desktop.
DEMO TABLE V1
import Ember from 'ember';
import Table from 'ember-light-table';
const { computed, Component, get, set } = Ember;
export default Component.extend({
init() {
this._super(...arguments);
set(this, 'table', new Table(get(this, 'columns'), get(this, 'model')));
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
columns: [{
label: 'foo',
resizable: true,
draggable: true,
valuePath: 'foo',
width: '100px'
}, {
label: 'bar',
resizable: true,
draggable: true,
valuePath: 'bar',
width: '100px'
}, {
label: 'baz',
resizable: true,
draggable: true,
valuePath: 'baz',
width: '100px'
}, {
label: 'other',
resizable: true,
draggable: true,
valuePath: 'baz',
width: '100px'
}, {
label: 'new',
resizable: true,
draggable: true,
valuePath: 'baz',
width: '100px'
}, {
label: 'address',
resizable: true,
draggable: true,
valuePath: 'address'
}],
model: [
{foo: 123, bar: 321, baz:"test", address: "000 Balistreri Centers Suite 27" },
{foo: 123, bar: 321, baz:"test", address: "000 Balistreri Centers Suite 272" },
{foo: 123, bar: 321, baz:"test", address: "000 Balistreri Centers Suite 272" },
{foo: 123, bar: 321, baz:"test", address: "000 Balistreri Centers Suite 272" },
{foo: 123, bar: 321, baz:"test", address: "000 Balistreri Centers Suite 272" },
{foo: 123, bar: 321, baz:"test", address: "000 Balistreri Centers Suite 272" }
]
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.lt-column {
font-weight: 700;
padding: 10px 8px;
height: 43.5px;
border-bottom: 2px solid #111;
border-right: 1px solid #111;
}
.lt-column.is-drag-target::after {
position: absolute;
top: 0;
background-color: red;
content: '';
width: 2px;
height: 100%;
z-index: 2;
}
.lt-column.drag-right::after {
right: -1px;
}
.lt-column.drag-left::after {
left: -1px;
}
.lt-cell {
position: relative;
padding: 10px 8px;
color: #222;
border-right: 1px solid #111;
height: 43.5px;
}
{{demo-table model=model columns=columns}}
{{#light-table table height='300px' as |t|}}
{{t.head
fixed=true}}
{{#t.body
canSelect=false
multiRowExpansion=false
as |body|}}
{{/t.body}}
{{/light-table}}
{
"version": "0.11.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0"
},
"addons": {
"ember-light-table": "1.10.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment