2

我已经通过使用敲除映射插件将我的 json 数组绑定到敲除

JSON

{
   "info":[
      {
         "Name":"Noob Here",
         "Major":"Language",
         "Sex":"Male",
         "English":"15",
         "Japanese":"5",
         "Calculus":"0",
         "Geometry":"20"
      },
      {
         "Name":"Noob Here",
         "Major":"Calculus",
         "Sex":"Female",
         "English":"0.5",
         "Japanese":"40",
         "Calculus":"20",
         "Geometry":"05"
      }
   ]
}

使用敲除映射插件绑定

var data = [];
$.each(data1.info, function (index, element) {
            data.push({
                English: element.English,
                Japanese: element.Japanese,
                Calculus: element.Calculus,
                Geometry: element.Geometry,
                name: element.Name,
                major: element.Major,
                sex: element.Sex
            });
        });

        dataFunction.prototype = function () {
            var getAllItems = function () {
                var self = this;
                ko.mapping.fromJS(data, {}, self.Items);
            };

现在我想提醒一下英语的价值。

alert(this.English());我在里面试过dataFunction.prototype,它不起作用。

如何提醒该值?

JS-Bin 代码:http: //jsbin.com/ipeseq/4/edit

4

1 回答 1

1
于 2013-03-22T21:00:56.887 回答