Simple way
- open index.html in the browser
- unzip
- run in the app's folder
npm install -g slush slush-webix
slush webix
- open index.html in the browser
Prerequisite
- nodejs
- bower
- run in the app's folder
npm install -g slush slush-webix
slush webix
Prerequisite
- nodejs
- bower
- open index.html in the browser
app.js
/ views
/models
/helpers
/libs
- configs
- webix views
- data and data related logic
- other code
- webix, routie, requirejs, etc.
//views/start.js
define([],function(){
return {
template:"Start page"
};
});
//views/top.js
define(["views/start", function(start){
return {
cols:[
{ view:"menu" },
start
]
};
});
index.html#!/start
index.html#!/top
//views/top.js
define([], function(){
return {
cols:[
{ view:"menu" },
{ $subview: true }
]
};
})
index.html/top/data
index.html#!/top/top/data
index.html#!/data
index.html#!/top
//views/data.js
define(["models/records"],function(records){
var ui = {
view:"datatable", autoConfig:true
};
return {
$ui: ui,
$oninit:function(view){
view.parse(records.getData());
}
};
});
//models/records
define([],function(){
var collection = new webix.DataCollection({ data:[
{ id:1, title:"The Shawshank Redemption", year:1994 },
/*...*/
]});
return {
getData: function(){
return collection;
}
};
});
//views/data.js
define(["models/records"],function(records){
var ui = {
view:"datatable", autoConfig:true
};
return {
$ui: ui,
$oninit:function(view){
view.parse(records.getData());
}
};
});
//models/records
define([],function(){
return {
getData: function(){
return webix.ajax("data.php");
}
};
});
//helpers/math.js
define([], function(){
return {
inc:function(a){ return a+1; }
}
})
define([],function(){
var collection = new webix.DataCollection({ url:"rest->/records", save:"rest->/records" });
return {
getData: function(){
return collection;
}
};
});
define([],function(){
return {
dataFeed: "/rest->data.php"
};
});
define(["models/records"],function(model){
return {
view:"datatable", url:model.dataFeed, save:model.dataFeed
};
});
Model
View
OR
Not really