Child rows (show extra / detailed information), how to it with nested data ?

Child rows (show extra / detailed information), how to it with nested data ?

mlotfimlotfi Posts: 60Questions: 5Answers: 0
edited November 2014 in Free community support

Hi,

I was inspired by this example ?
http://www.datatables.net/examples/api/row_details.html

so I tried to duplicate it in jsfiddle, I want when the user click in the plus icon it will show some extra data.
http://s22.postimg.org/bh3lnyy9d/Screen_Shot_2014_11_29_at_3_49_59_PM.png

1) can you please help me on how to construct the ajax data to have "agencies" and "globals" in the json :

Is this correct :

{
  "data": [
    {
      "name": "Tiger Nixon",
      "position": "System Architect",
      "salary": "$320,800",
      "start_date": "2011/04/25",
      "office": "Edinburgh",
      "extn": "5421",
      "agencies": {
        "name": "agency2",
        "name": "agency5",
        "name": "agency24",
      },
      "globals": {
        "name": "global42",
        "name": "global13",
        "name": "global4",
      }
    },
    ......
    ......
    {
      "name": "Donna Snider",
      "position": "Customer Support",
      "salary": "$112,000",
      "start_date": "2011/01/25",
      "office": "New York",
      "extn": "4226",
      "agencies": {
        "name": "agency23",
        "name": "agency56",
        "name": "agency2",
      },
      "globals": {
        "name": "global2",
        "name": "global13",
        "name": "global45",
      }
    }
  ]
}

2) How to change that format function to get data from the json, here is my fiddle :

http://jsfiddle.net/mlotfi/c918of1t/

This discussion has been closed.