Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:55:11+00:00 2026-06-12T17:55:11+00:00

The JSON coming back from the server (used for populating the dataTable ) looks

  • 0

The JSON coming back from the server (used for populating the dataTable) looks like:

[
   {
      "id":1,
      "attributeType":{
         "id":1,
         "name":"test1",
         "tag":"test-type",
         "is-dog":false
      },
      "attributeValue":{
         "id":null,
         "name":"blah",
         "tag":"BLAH"
      },
      "buzz":1,
      "fizz":"53abc"
   }
]

However, I only want to display the following fields:

  • id
  • attributeValue.name
  • buzz

And furthermore, I want them displayed in the following order (left to right):

  • buzz
  • attributeValue.name
  • id

How can I configure my dataTable to select only these three fields, and to display them in the desired order? Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:55:13+00:00Added an answer on June 12, 2026 at 5:55 pm

    What you could do to achive this is build your table dynamically and then send this to the datatable.

    In the following example I am assuming the Json is coming back in a jQuery Ajax call and you have multiple items in your response:

    $.ajax({
        type: "POST",
        url: "Controller Url",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
    ...
    ...
    success: function (response) {
    
    // Assuming you need to parse, you may not need to depending on how the data is returned.
    var parsedJson = $.parseJSON(response); 
    // Empty var to hold the table content.
    var buildTable = "";
    
    $.each(parsedJson, function(i)) {
        buildTable += "<tr>";
        buildTable += "<td>" + parsedJson[i].buzz + "</td>";
        buildTable += "<td>" + parsedJson[i].attributeValue.name + "</td>";
        buildTable += "<td>" + parsedJson[i].id + "</td>";
        buildTable += "</tr>";
    });
    
    // Now fill your datatable with the table content in the order you want and with only the fields required.
    $("#datatableContent").append(buildTable);
    
    // Configure your datatable
    $('#datatableContent').dataTable({ });
    
    } //end success
    
    });// end ajax
    

    In your View you would have:

    <table id="datatableContent">
    <thead>
        <tr>
            <th>Buzz</th>
            <th>Name</th>
            <th>ID</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
    

    One thing to bear in mind is that I had problems if I placed the $('#datatableContent').dataTable({ }); config part outwith the success of the ajax call. I have mines placed after the $("#datatableContent").append(buildTable); line within the success and it works perfectly every time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the json coming from the server: { name:channelname, args: [ { username:myusername,
I have a view model coming from the server as json like this {
Issue : I have Json coming back from the server. The Json is an
I have the following JSON coming back from a web service which I am
I am trying to bind a model coming from the server over json to
I've got the JSON coming back like this: { responseData: [{ responseData: { translatedText:
I have the following JSON string coming back from a Node JS Service: {\success\:true,\isavailable\:true}
I have a JSON array coming in from the server with an array of
I have a stream of JSON coming back and am building a table dynamically
I have a json object coming in as { c_id: 261, customer_id: 178729, name:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.