Nested JSON help!

Nested JSON help!

james Kjames K Posts: 4Questions: 3Answers: 1

Hi !
I am new to using Datatables.
If I have JSON structure like below and I want to display EmployeeID and EmployeeRecord, how should I go about..?

Please suggest...
Thank You

{
    queryString: "/employeeid==1234*",
    message: null,
    dateTimeAsString: "06-20-2017 15:02:56",
    size: 2,
    myTableRows: [
            {
                columns: {
                EmployeeID: "12340164",
                EmployeeRecord: "0"
                }
            },
            {
                columns: {
                EmployeeID: "12343111",
                EmployeeRecord: "0"
                }
            }
    ]
}

This question has accepted answers - jump to:

Answers

  • james Kjames K Posts: 4Questions: 3Answers: 1
    Answer ✓

    I have it figured out.

    "dataSrc":"myTableRows"
    
            "columns": [
    
                { "data": "columns.EmployeeID" },
                { "data": "columns.EmployeeRecord" }
    
  • allanallan Posts: 62,029Questions: 1Answers: 10,168 Site admin
    Answer ✓

    The dataSrc property needs to be nested in ajax (ajax.dataSrc), but yes, that is exactly correct. There is a running example of that available here.

    Allan

This discussion has been closed.