jQWidgets Forums

jQuery UI Widgets Forums Grid grid with nested json input from vSphere data

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 6 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • kathyl
    Participant

    I am trying to produce a grid of all the VM’s a client has running on an ESXi server. I get this data in json format (it is valid json as I’ve run it through several json validators). I’ve read the following:

    Nested JSON

    and am attempting to display a grid. A sample of the data is here:

    {"ABC-DEV": {ABC-DEV-Cluster": "prd-esx1.abc.com": {}, 
                                    "prd-esx2.abc.com": {"vm1": {"mem": "1500", "diskGB": "10.00", "cpu": "2", "state:"poweredOn"}},
                                                        {"vm2": {"mem": "1500", "diskGB": "40.00", "cpu": "1", "state:"poweredOn"}},
                                                        ........}}
    "ABC-PROD": {"ABC-PRD-Cluster": "prd-esx12.abc.com": {},
                                    "prd-esx14.abc.com": {"vm12": {"mem": "1500", "diskGB": "10.00", "cpu": "2", "state:"poweredOn"}},
                                                        {"vm14": {"mem": "1500", "diskGB": "40.00", "cpu": "1", "state:"poweredOn"}},
                                                        ........}}

    and here is the source:

    var source {
        datatype: "json",
        url: "vms.json",
        datafields: [
               name: 'mem', map: "ABC-PRD>ABC-PRD-Cluster>prd-esx14.abc.com>0>mem"},
               .....
    }

    I would like my grid to look like this:

    vm12     1500  10.00   2   poweredOn
    .....

    I’m not sure what the “0” in the datafields definition, and how to list the vm name, etc. Can anyone help me with how to properly define the data source for this data? Thanks.


    Peter Stoev
    Keymaster

    Hi kathyl,

    0, 1, 2, … represent an index in an array. Could you share codepen or jsfiddle sample?

    Regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.