Backbone'da yeni olduğum sırada doldurulmaz. Bu yüzden REST servisinden veri almaya çalışıyorum.Backbone.js + Rest. Toplama, getirme()
bu benim basit kodu: JSON sonraki
$(function() {
var Entity = Backbone.Model.extend({
url: function() {
return 'http://localhost:8080/rest/entity/'+this.id;
}
});
var EntityList = Backbone.Collection.extend({
model: Entity,
url: 'http://localhost:8080/rest/entity'
});
var entityList = new EntityList();
entityList.fetch();
});
benim dinlenme hizmeti verir:
ayıklayıcıya olarak[{"id":1387,
"version":3,
"entityName":"entity01",
"entityLabel":"Entity01",
"entityPluralLabel":"Entity01",
"attributes":
[{"id":1425,
"slot":"D001",
"version":0,
"attributeName":"dfield",
"attributeType":
{"id":7,
"description":"Date",
"attributeType":"date",
"databaseType":"DATE"
},
"options":[],
"order":2,
"attributeLabel":"dField",
"checked":null
},
{"id":1424,
"slot":"S001",
"version":0,
"attributeName":"txfield",
"attributeType":
{"id":1,
"description":"Textbox",
"attributeType":"textbox",
"databaseType":"STRING"
},
"options":[],
"order":1,
"attributeLabel":"txField",
"checked":null
}
]
},
{"id":1426,
"version":3,
"entityName":"entity02",
"entityLabel":"Entity02",
"entityPluralLabel":"Entity02",
"attributes":
[{"id":1464,
"slot":"D001",
"version":0,
"attributeName":"dfield",
"attributeType":
{"id":7,
"description":"Date",
"attributeType":"date",
"databaseType":"DATE"
},
"options":[],
"order":2,
"attributeLabel":"dField",
"checked":null
}
]
}
]
nasıl yapabilirim, bunu talep DİNLENME hizmetine gönderilir ve yanıt ve aldıkları oldu bakın entityList koleksiyonunun alınan verilerle doldurulup doldurulmadığını öğrenmek için bkz. Debugger entityList.models öğesinden sonra entityList.fetch();
Doğru yolda mıyım yoksa kodumda bir şey mi var?
Omurganın Sourcecode edilir gayet basit. Belki de neler olduğunu görmek için gerçek omurga kaynağına adım atmaya yardımcı olur. – Evert