请在Dojo的ObjectStore中查询

时间:2015-08-24 11:58:03

标签: json dojo getjson

我有以下Json数据并将其存储在ObjectStore(dojo.data.ObjectStore)中,我想查询" help":" 32-2"并希望从ObjectStore获取数据。请问你能建议怎么做?

JSON:
{
  "identifier": "id",
  "label": "aid",
  "items": [
    {
      "responseStatus": null,
      "entityType": "PSS32",
      "aid": "PSS32",
      "id": "0",
      "hsa": "Clear",
      "parentId": "0",
      "eqList": [
        {
          "responseStatus": null,
          "entityType": "SUBNET",
          "aid": "DEFAULT",
          "id": "1",
          "hsa": "Clear",
          "parentId": "0",
          "eqList": [
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "32-2",
              "id": "32-2",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "203",
                  "neGroupId": "401",
                  "aid": "32-2",
                  "neType": "1830pss-32",
                  "neRelease": "7.0",
                  "eqList": [
                    {
                      "id": "32-2/32-2/Equipment"
                    }
                  ],
                  "id": "32-2/32-2",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "32-2_AddDrop",
              "id": "32-2_AddDrop",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "208",
                  "neGroupId": "401",
                  "aid": "32-2_AddDrop",
                  "neType": "1830pss-32",
                  "neRelease": "7.0",
                  "eqList": [
                    {
                      "id": "32-2_AddDrop/32-2_AddDrop/Equipment"
                    }
                  ],
                  "id": "32-2_AddDrop/32-2_AddDrop",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "209",
                  "neGroupId": "401",
                  "aid": "32-2_AddDrop#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "7.0",
                  "eqList": [
                    {
                      "id": "32-2_AddDrop/32-2_AddDrop#OCS/Equipment"
                    }
                  ],
                  "id": "32-2_AddDrop/32-2_AddDrop#OCS",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "32-3",
              "id": "32-3",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "210",
                  "neGroupId": "401",
                  "aid": "32-3",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "32-3/32-3/Equipment"
                    }
                  ],
                  "id": "32-3/32-3",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "211",
                  "neGroupId": "401",
                  "aid": "32-3#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "7.0",
                  "eqList": [
                    {
                      "id": "32-3/32-3#OCS/Equipment"
                    }
                  ],
                  "id": "32-3/32-3#OCS",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "ABC",
              "id": "ABC",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "214",
                  "neGroupId": "400",
                  "aid": "ABC",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "ABC/ABC/Equipment"
                    }
                  ],
                  "id": "ABC/ABC",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "ADMIN",
              "id": "ADMIN",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "170",
                  "neGroupId": "400",
                  "aid": "ADMIN#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "ADMIN/ADMIN#OCS/Equipment"
                    }
                  ],
                  "id": "ADMIN/ADMIN#OCS",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "DNB_OCS",
              "id": "DNB_OCS",
              "hsa": "CRITICAL",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "158",
                  "neGroupId": "401",
                  "aid": "DNB_OCS#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "7.0",
                  "eqList": [
                    {
                      "id": "DNB_OCS/DNB_OCS#OCS/Equipment"
                    }
                  ],
                  "id": "DNB_OCS/DNB_OCS#OCS",
                  "entityType": "NE",
                  "hsa": "CRITICAL"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "LANZERO",
              "id": "LANZERO",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "168",
                  "neGroupId": "400",
                  "aid": "LANZERO",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "LANZERO/LANZERO/Equipment"
                    }
                  ],
                  "id": "LANZERO/LANZERO",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "MRN-VIMSETUP-01",
              "id": "MRN-VIMSETUP-01",
              "hsa": "CRITICAL",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "163",
                  "neGroupId": "401",
                  "aid": "MRN-VIMSETUP-01",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "MRN-VIMSETUP-01/MRN-VIMSETUP-01/Equipment"
                    }
                  ],
                  "id": "MRN-VIMSETUP-01/MRN-VIMSETUP-01",
                  "entityType": "NE",
                  "hsa": "CRITICAL"
                },
                {
                  "neId": "162",
                  "neGroupId": "401",
                  "aid": "MRN-VIMSETUP-01#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "MRN-VIMSETUP-01/MRN-VIMSETUP-01#OCS/Equipment"
                    }
                  ],
                  "id": "MRN-VIMSETUP-01/MRN-VIMSETUP-01#OCS",
                  "entityType": "NE",
                  "hsa": "CRITICAL"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "MRN-VIMSETUP-02",
              "id": "MRN-VIMSETUP-02",
              "hsa": "CRITICAL",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "165",
                  "neGroupId": "401",
                  "aid": "MRN-VIMSETUP-02",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "MRN-VIMSETUP-02/MRN-VIMSETUP-02/Equipment"
                    }
                  ],
                  "id": "MRN-VIMSETUP-02/MRN-VIMSETUP-02",
                  "entityType": "NE",
                  "hsa": "CRITICAL"
                },
                {
                  "neId": "164",
                  "neGroupId": "401",
                  "aid": "MRN-VIMSETUP-02#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "MRN-VIMSETUP-02/MRN-VIMSETUP-02#OCS/Equipment"
                    }
                  ],
                  "id": "MRN-VIMSETUP-02/MRN-VIMSETUP-02#OCS",
                  "entityType": "NE",
                  "hsa": "CRITICAL"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "MRN-VIMSETUP-03",
              "id": "MRN-VIMSETUP-03",
              "hsa": "CRITICAL",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "166",
                  "neGroupId": "401",
                  "aid": "MRN-VIMSETUP-03",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "MRN-VIMSETUP-03/MRN-VIMSETUP-03/Equipment"
                    }
                  ],
                  "id": "MRN-VIMSETUP-03/MRN-VIMSETUP-03",
                  "entityType": "NE",
                  "hsa": "CRITICAL"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "PSS32.64-EQM-178_173",
              "id": "PSS32.64-EQM-178_173",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "212",
                  "neGroupId": "401",
                  "aid": "PSS32.64-EQM-178_173",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "PSS32.64-EQM-178_173/PSS32.64-EQM-178_173/Equipment"
                    }
                  ],
                  "id": "PSS32.64-EQM-178_173/PSS32.64-EQM-178_173",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "213",
                  "neGroupId": "401",
                  "aid": "PSS32.64-EQM-178_173#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "PSS32.64-EQM-178_173/PSS32.64-EQM-178_173#OCS/Equipment"
                    }
                  ],
                  "id": "PSS32.64-EQM-178_173/PSS32.64-EQM-178_173#OCS",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "SRI_PHN",
              "id": "SRI_PHN",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "188",
                  "neGroupId": "400",
                  "aid": "SRI_PHN",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "SRI_PHN/SRI_PHN/Equipment"
                    }
                  ],
                  "id": "SRI_PHN/SRI_PHN",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "189",
                  "neGroupId": "400",
                  "aid": "SRI_PHN#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "SRI_PHN/SRI_PHN#OCS/Equipment"
                    }
                  ],
                  "id": "SRI_PHN/SRI_PHN#OCS",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "191",
                  "neGroupId": "400",
                  "aid": "SRI_PHN#TC1",
                  "neType": "1830pss-tdmxc",
                  "neRelease": "2.3",
                  "id": "SRI_PHN/SRI_PHN#TC1",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "190",
                  "neGroupId": "400",
                  "aid": "SRI_PHN#TD1",
                  "neType": "1830pss-tdmx",
                  "neRelease": "2.3",
                  "id": "SRI_PHN/SRI_PHN#TD1",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            },
            {
              "responseStatus": null,
              "entityType": "NODE",
              "aid": "TEST_ALL",
              "id": "TEST_ALL",
              "hsa": "-",
              "parentId": "1",
              "eqList": [
                {
                  "neId": "173",
                  "neGroupId": "400",
                  "aid": "TEST_ALL",
                  "neType": "1830pss-32",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "TEST_ALL/TEST_ALL/Equipment"
                    }
                  ],
                  "id": "TEST_ALL/TEST_ALL",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "174",
                  "neGroupId": "400",
                  "aid": "TEST_ALL#OCS",
                  "neType": "1830pss-ocs",
                  "neRelease": "8.0",
                  "eqList": [
                    {
                      "id": "TEST_ALL/TEST_ALL#OCS/Equipment"
                    }
                  ],
                  "id": "TEST_ALL/TEST_ALL#OCS",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "176",
                  "neGroupId": "400",
                  "aid": "TEST_ALL#TC1",
                  "neType": "1830pss-tdmxc",
                  "neRelease": "2.3",
                  "id": "TEST_ALL/TEST_ALL#TC1",
                  "entityType": "NE",
                  "hsa": "-"
                },
                {
                  "neId": "175",
                  "neGroupId": "400",
                  "aid": "TEST_ALL#TD1",
                  "neType": "1830pss-tdmx",
                  "neRelease": "2.3",
                  "id": "TEST_ALL/TEST_ALL#TD1",
                  "entityType": "NE",
                  "hsa": "-"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

我有Json数据如下并将其存储在ObjectStore()中,我想查询"援助":" 32-2"并希望从ObjectStore获取数据。请问你能建议怎么做?

1 个答案:

答案 0 :(得分:0)

我看到你在嵌套数据中有32-2的帮助而不是顶层。如果你需要根据嵌套键进行查询,那么你可能需要在查询选择器中提到关系。

请参阅:http://dojotoolkit.org/reference-guide/1.10/dojo/store/Memory.html