Skip to content

Instantly share code, notes, and snippets.

@phillipkregg
Last active July 19, 2016 18:04
Show Gist options
  • Save phillipkregg/7ee8890dba482f8e1802e84c7a077817 to your computer and use it in GitHub Desktop.
Save phillipkregg/7ee8890dba482f8e1802e84c7a077817 to your computer and use it in GitHub Desktop.
Webix Integration
import Ember from 'ember';
export default Ember.Component.extend({
// The component is instantiated inside the templates/application.hbs file.
// 'didInsertElement' is a lifecycle hook that waits for the component to
// first be added to the dom, then you can call the webix global to start
// creating the view itself.
//
// The data is passed here from the 'model' attribute added to the component
// on the templates/application.hbs template. And that template got the data
// from the /routes/application.js route file model hook.
didInsertElement: function() {
webix.ui({
view:"dataview",
template:"<div class='webix_strong'>#title#</div> Year: #year#, rank: #rank#",
data: this.get('model'),
xCount:3, //the number of items in a row
yCount:4 //the number of items in a column
});
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return [
{title: 'The Shawshank Redemption', rank: '1', year: '1994'},
{title: 'The Godfather Part II', rank: '3', year: '1974'}
]
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{webix-dataview
model=model
}}
{
"version": "0.10.1",
"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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0",
"webix-css": "http://cdn.webix.com/edge/webix.css",
"webix": "https://cdn.webix.com/edge/webix.js"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment