Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions samples/03_load_collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,27 @@
</head>
<body>
<div style="height:300px" class="app1_here"></div>

<br>
<div id="controls">
<input type="button" value="Add" onclick='films.addSample()'>
<input type="button" value="Delete first" onclick='films.deleteFirst()'>
</div>

<script type="text/javascript" charset="utf-8">
$(".app1_here").webix_list({
id:"mylist", width:200,
template:"#title#", select:true
});

new WebixView({
el:".app1_here",
config:{
rows:[
{
view:"list",
template:"#title#", select:true,
id:"mylist"
}
]
}
}).render();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50 line add if (this.length) to make sure no attempt to remove will be taken if no models are left in the collection


FilmRecord = Backbone.Model.extend({});
FilmList = Backbone.Collection.extend({
Expand All @@ -48,4 +57,4 @@
$$("mylist").sync(films);
</script>
</body>
</html>
</html>
21 changes: 15 additions & 6 deletions samples/04_save_collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,27 @@
</head>
<body>
<div style="height:300px" class="app1_here"></div>

<br>
<div id="controls">
<input type="button" value="Add" onclick='$$("mylist").add({ title:"New Item" }, 1)'>
<input type="button" value="Delete first" onclick='$$("mylist").remove($$("mylist").getFirstId())'>
</div>

<script type="text/javascript" charset="utf-8">
$(".app1_here").webix_list({
id:"mylist", width:200,
template:"#title#", select:true
});

new WebixView({
el:".app1_here",
config:{
rows:[
{
view:"list",
template:"#title#", select:true,
id:"mylist"
}
]
}
}).render();

FilmRecord = Backbone.Model.extend({});
FilmList = Backbone.Collection.extend({
Expand All @@ -44,4 +53,4 @@
$$("mylist").sync(films);
</script>
</body>
</html>
</html>
11 changes: 6 additions & 5 deletions samples/07_routes_views.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
</head>
<body>
<div style="height:300px; width:200px" id="app1_here"></div>


<script type="text/javascript" charset="utf-8">
var routes = new (Backbone.Router.extend({
routes:{
"":"index",
"":"index",
"films/:id":"details"
},
details:function(id){
template.render();
if($$("mylist")){ $$("mylist").destructor();}
},
index:function(){
layout.render();
Expand Down Expand Up @@ -58,7 +59,7 @@

//init app
Backbone.history.start();

</script>
</body>
</html>
</html>
20 changes: 12 additions & 8 deletions samples/08_routes_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
</head>
<body>
<div style="height:300px; width:200px" id="app1_here"></div>


<script type="text/javascript" charset="utf-8">
var routes = new (Backbone.Router.extend({
routes:{
"":"index",
"":"index",
"films/:id":"details"
},
details:function(id){
Expand All @@ -39,9 +39,13 @@
});
var list = new WebixView({
config:{
view:"list", url:"common/data.json",
template:"#title#", select:true,
id:"mylist"
rows:[
{
view:"list", url:"common/data.json",
template:"#title#", select:true,
id:"mylist"
}
]
}
});
var layout = new WebixView({
Expand All @@ -58,7 +62,7 @@
//init app
layout.render();
Backbone.history.start();

</script>
</body>
</html>
</html>