Datatables columns changed on ajax call

Datatables columns changed on ajax call

marioscharmarioschar Posts: 1Questions: 1Answers: 0

I have an ajax Datatable which calls BE API to retrieve data:

tableColumns = 
    {"data": "Id","name": "Id","title": "Id"},
    {"data": "Code", "name": "Code", "title": "Code"},
    {"data": "DisplayCode", "name": "DisplayCode","title": "DisplayCode"},
    {"data": "Name","name": "Name","title": "Name"},
    {"data": "Country","name": "Country", "title": "Country"},
    {"data": "BackColor","name": "BackColor","title": "BackColor"},
    {"data": "ForeColor", "name": "ForeColor","title": "ForeColor"}

        ajax: {
            url: tableurl,
            type: "POST",
        dom: '<fB<t>lip>',
        buttons: true,
        processing: true,
        serverSide: true,
        filter: true,
        columns: tableColumns

Debbuging screenshot of my BE method returned json:

After investigating the response on the browser the columns first letter become lower case e.x backColor, displayCode. Why is this happens ? Is this something that Datatable Api mechanisms do by default ?


  • kthorngrenkthorngren Posts: 19,974Questions: 26Answers: 4,702

    Datatables is not involved with what the server returns. I suspect its something the Json() function is doing in your server code. Take a look at the docs for Json(). There might be a flag to stop the case conversion.


Sign In or Register to comment.