以下は、HttpMapRoute "serviceUrl.
<ArrayOfProject>
<Project>
<AssignedUserId>5</AssignedUserId>
<CreatedByUserId>1</CreatedByUserId>
<CreatedOnDate>2013-08-15T01:18:37.443</CreatedOnDate>
<LastModifiedByUserId>1</LastModifiedByUserId>
<LastModifiedOnDate>2013-08-15T01:24:57.953</LastModifiedOnDate>
<ProjectDescription>Testing javascript and MVVM with DNN-platform
</ProjectDescription>
<ProjectId>1</ProjectId>
<ProjectName>javascript and DNN</ProjectName>
<Purpose>For fun</Purpose>
</Project>
<Project>
<AssignedUserId>5</AssignedUserId>
<CreatedByUserId>1</CreatedByUserId>
<CreatedOnDate>2013-08-15T01:18:37.443</CreatedOnDate>
<LastModifiedByUserId>1</LastModifiedByUserId>
<LastModifiedOnDate>2013-08-15T01:27:57.419</LastModifiedOnDate>
<ProjectDescription>DNN Module design in development and Skins
</ProjectDescription>
<ProjectId>2</ProjectId>
<ProjectName>CSS systems in DNN</ProjectName>
</Project>
</ArrayOfProject>
私のJSON呼び出しは次のとおりです。
self.projectCollection = ko.observableArray([]);
$.getJSON(serviceUrl, function (allData) {
var i = 0;
$.each(allData, self.projectCollection.push(new Project(allData[i++])));
});
... Project は関数です:
function Project(data) {
var self = this;
self.projectname = ko.observable(data.ProjectName);
self.description = ko.observable(data.ProjectDescription);
self.assigneduserid = ko.observable(data.AssignedUserId);
self.createdondate = ko.observable(data.CreatedOnDate);
self.createdbyuserid = ko.observable(data.CreatedByUserId);
self.lastmodifiedondate = ko.observable(data.LastModifiedOnDate);
self.lastmodifiedbyuserid = ko.observable(data.LastModifiedByUserId);
}
「projectColletion」に最初の Project 以外のものが入力されないのはなぜですか?