用appcelerator在表中加载json

时间:2012-01-28 16:32:40

标签: android json appcelerator appcelerator-mobile

我正在使用由drupal webservice提供支持的appcelerator构建一个Android应用程序。我在将JSON服务的结果打印到表中时遇到问题。每个tablerow都需要包含该特定节点的值字段。谁能告诉我这段代码有什么问题?

xhr.onload = function()
  {
    Ti.API.info(this.responseText);

    var response = JSON.parse(this.responseText);
    for (var i in response) {
      node = response[i];
      var row = Ti.UI.createTableViewRow({
        title : node.body,
      });
      nodes.push(row);
    }
    nodeTable.data = nodes;
};

JSON结果如下所示:

{"vid":"1","uid":"1","title":"Artikel 1","log":"","status":"1","comment":"0","promote":"1","sticky":"0","nid":"1","type":"artikel","language":"und","created":"1326833844","changed":"1326833844","tnid":"0","translate":"0","revision_timestamp":"1326833844","revision_uid":"1","body":{"und":[{"value":"This needs to be in the tablerow","summary":"","format":"plain_text","safe_value":"<'p'>This needs to be in the tablerow</'p'>\n","safe_summary":""}]},"name":"SVP","picture":"0","data":"b:0;","path":"http://192.168.1.202/inda/node/1"}

0 个答案:

没有答案