Columns header displaying incorrect data, headers defined not matching what JSON data is returning

Columns header displaying incorrect data, headers defined not matching what JSON data is returning

thenewerthenewer Posts: 11Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
I am trying the Datatables as my Subject is self explanatory what i am trying, the following is the code which is causing me a trouble!

$(document).ready(function() {
$('#eData').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "abc.php",
"sPaginationType": "full_numbers",
"aaSorting": [[1,'asc']],
"iDisplayStart": 0,
"sEcho":1,
"bLengthChange":false,
"aoColumns": [
{"sName": "projectid", "sTitle": ID", "sWidth": "10%", "bSortable": "true"},
{"sName": "name", "sTitle": "Name", "sWidth": "20%", "bSortable": "true"}
]
});
});

Now the Problem i get the JSOn response but the data returned does not match the headers i defined, it shows the data on rong columns, please correct me where this left out!

by theway very great Plugin

Awesome :)

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    what does your data look like? how is it not matching?
  • thenewerthenewer Posts: 11Questions: 0Answers: 0
    i am getting the response as:

    duedate,pid,name,step

    while i am viewing the data in my dataTables as:

    PID, NAME, STEP, Due Date

    So the data coming from JSON is not putting the correct column value under correct colum header, if you see, i am getting the result as

    duedate,pid,name,step while i want to display on my screen as:

    PID, NAME, STEP, Due Date and it should should exact data under the exact column but my whole data is scattered
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    what does your server side script and query look like?
  • thenewerthenewer Posts: 11Questions: 0Answers: 0
    Server side Coldfusion and query is actually a QoQ because i have to filter multiple queries so i am storing the query data in a variable and then doing a QoQ of the selected variable.

    i dumped my query in out put and it showed me like this:

    select duedate,pid,name,step from stablename where 1=1 and duedate like %a% or pid like %a% or name like %a% or step like %a% order by name asc
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    unless your server side code takes the client parameters/columns into account, you won't get the server-side processing behavior in DataTables.
  • thenewerthenewer Posts: 11Questions: 0Answers: 0
    how do i do that can u provide some code to show me, tht will be really helpful
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    this might help. http://datatables.net/development/server-side/coldfusion


    I don't know any coldfusion, so I can't advise you myself.
This discussion has been closed.