1

I have a json message in the below format returned from the server. I using jquery data tables to display the data in the table. I am getting some error when trying to use jquery data table. Please let me know where I am going wrong in the configuration of jquery data table to display the below json format. The configuration for jquery data table along with the json data is given below:

 $(function  ()  {
    $('#dataTable').dataTable( {
      "bJQueryUI": true,
      "sPaginationType": "full_numbers",
      "aaData": [
        {
          "links": [
            {
              "rel": "self", // the first column data which should be displayed as link
              "href": "http://localhost:8080/16"
            }
          ],
          "Country": "INDIA",
          "state": "Karnataka",
          "city": "Bangalore",
          "cityId": 16
        },
        {
          "links": [
            {
              "rel": "self",
              "href": "http://localhost:8080/17"
            }
          ],
          "Country": "INDIA",
          "state": "Tamilnadu",
          "city": "Chennai",
          "cityId": 17
        }
      ]
    });

1 Answer 1

1

A little look up on the jquery datatables documentation helped me to get to the solution. The trick is to use the mData and then map the columns to the attributes from the json. The link for the same is mentioned below:

http://datatables.net/release-datatables/examples/server_side/object_data.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.