StudentModel = Backbone.Model.extend({
defaults: {
name: "unknown"
}
});
StudientCollection = Backbone.Collection.extend({
model: StudentModel
});
jQuery(document).ready(function($) {
var jony = new StudentModel({name: "Lionel1",id: 1});
var vicky = new StudentModel({name: "Lionel2",id: 2});
var classones = new StudientCollection([jony, vicky]);
displayCollectionContents("Two element:", classones);
});
function displayCollectionContents(string, collection) {
console.log(string + " " + JSON.stringify(collection.toJSON()));
}
StudentModel = Backbone.Model.extend({
defaults: {
name: "unknown"
}
});
StudientCollection = Backbone.Collection.extend({
model: StudentModel
});
jQuery(document).ready(function($) {
var jony = new StudentModel({name: "Lionel1",id: 1});
var vicky = new StudentModel({name: "Lionel2",id: 2});
var pank = new StudentModel({name: "Lionel3",id: 3});
var classones = new StudientCollection([jony, vicky]);
classones.add(pank);
displayCollectionContents("Three element:", classones);
});
function displayCollectionContents(string, collection) {
console.log(string + " " + JSON.stringify(collection.toJSON()));
}
StudentModel = Backbone.Model.extend({
defaults: {
name: "unknown"
}
});
StudientCollection = Backbone.Collection.extend({
model: StudentModel
});
jQuery(document).ready(function($) {
var jony = new StudentModel({name: "Lionel1",id: 1});
var vicky = new StudentModel({name: "Lionel2",id: 2});
var pank = new StudentModel({name: "Lionel3",id: 3});
var classones = new StudientCollection([jony, vicky]);
classones.add(pank);
classones.remove(jony);
displayCollectionContents("Two element:", classones);
});
function displayCollectionContents(string, collection) {
console.log(string + " " + JSON.stringify(collection.toJSON()));
}