DataTables with complex JSON object

DataTables with complex JSON object

RayHerringRayHerring Posts: 11Questions: 5Answers: 0
edited June 2014 in Free community support

Trying to work out how to get DataTables to display the data in my table, the problem i am having is that i can't quite work out how to set up the columns for that JSON object.

NB: I can't change the JSON structure being returned from the backend, i have to live with how it is done.

Anyway, the DataTable is fetching the JSON, i can see it in the Firefox Network inspector as a response.

The JSON is structured as:

{"dsSettings": {
  "ttSettings": [
    {
      "ID": 1234,
      "Setting_Name": "SETTING1",
      "Setting_Value": "0.03"
    },
    {
      "ResultNum": 2468,
      "Setting_Name": "SETTING2",
      "Setting_Value": "1"
    }
  ]
}}

Trying to work out how to get the 'Setting' and 'Value' to appear in my DataTable.

Answers

  • RayHerringRayHerring Posts: 11Questions: 5Answers: 0

    n/m, worked it out.

    Had to set 'dataSrc' in the ajax section to be "dsSettings.ttSettings" and then in the columns section have: { data: "Setting_Name" }, { data: "Setting_Value" }

    Thought i had tried that earlier but it was failing, might have missed 1 simple little thing.

This discussion has been closed.