0
$.ajax({
    url: "apex/demopage",
    success: function(resp) {

    }
})

//and my resp coming as follows

[
    {
        "attributes": {
            "type": "something",
            "url": "something"
        },
        "fname": "something",
        "lname": "something"
    },
    {
        "attributes": {
            "type": "something",
            "url": "something"
        },
        "fname": "something",
        "lname": "something"
    }
]
1

In datatable, you can customize columns data to specify which property to use for columns. Here is an example below:

// JSON structure for each row in this example:
//   {
//      "engine": {value},
//      "browser": {value},
//      "platform": {value},
//      "version": {value},
//      "grade": {value}
//   }
$('#example').dataTable( {
  "ajaxSource": "sources/objects.txt",
  "columns": [
    { "data": "engine" },
    { "data": "browser" },
    { "data": "platform" },
    { "data": "version" },
    { "data": "grade" }
  ]
} );

For additional details, refer:

  1. Ajax data source (objects)
  2. Nested object data (objects)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.