如何将JSON放到商店(DOJO)

时间:2014-02-20 14:48:08

标签: javascript dojo

我有一个JSON数据,如下所示 URL(http://a.b.c.d:8080/myWS/services/GetIcDetail/IcView

[
{
    "Name": "A",
    "order": "1",
    "dir": "In",
    "pName": "1/2"
},
{
    "Name": "A",
    "order": "2",
    "dir": "Out",
    "pName": "1/2"
},
{
    "Name": "CWR8-88",
    "order": "4",
    "dir": "Out",
    "pName": "1/3/OMD"
},
{
    "Name": "11DPM12",
    "order": "5",
    "dir": "In",
    "pName": "1/5/L1"
}
]

如何将此JSON数据放入DOJO的商店?

修改

格式化并验证JSON数据。您可以编辑验证您的json here

1 个答案:

答案 0 :(得分:0)

要利用该模块,请在模块中创建一个新实例。

require(["dojo/store/JsonRest"], function(JsonRest){
  var store = new JsonRest({
    target: "/some/resource"
  });

  // Store an object identified by identity
  store.put({
    foo: "bar"
  }, {
    id: 3
  });

  // Remove an object by ID
  store.remove(3);
});