Problem with migration to v1.9.4

Problem with migration to v1.9.4

bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
edited October 2012 in DataTables 1.9
We used v1.8.1 for our old project. Now we are trying to migrate to 1.9.4. At this moment, we use twitter bootstrap 2.1, jquery 1.8.2 with datatable 1.9.2 but we still get errors.

Here is our code
HTML
[code]



User name
Source
DN(s)








[/code]

Javascript

[code]

$(document).ready(function() {
$("#tblUser").dataTable({
"bProcessing": true,
"bSort" : false,
"bServerSide": true,
"sAjaxSource": "${ctx}/jsp/struts/resource/fseuser/fseuser.do?method=generalUserList",
"aoColumnDefs": [
{
"fnRender": function ( oObj ) {
return "test";
},
"bUseRendered": false,
"aTargets": [ 0 ]
},
{
"fnRender": function ( oObj ) {
return "test";
},
"bUseRendered": false,
"aTargets": [ 1 ]
},
{
"fnRender": function ( oObj ) {
return "test";
},
"bUseRendered": false,
"aTargets": [ 2 ]
}
]
});
});


[/code]


And this is our responded data:

[code]
{"sEcho":0,"iTotalRecords":"10","iTotalDisplayRecords":"27","aaData":[{"acpId":"","acps":[],"certificate":[],"createDate":"2012-10-24 11:33:49","createUserKey":"","desc":"","descHtml":"","displayName":"cly4" .... }]}
[/code]

Datatable successfully retrieves data from server, but it cannot parse data and render on page. I have no error on firebug. Is there anyone having the same issue?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please link us to the page. I'm not aware of any Ajax issues in DataTables at this time.

    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    btw your sEcho, iTotalRecords and iTotalDisplayRecords in the JSON return are irrelevant since you aren't using server-side processing.

    Allan
  • bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
    The project is still under heavy construction so there is no real page for the outside yet. Sorry Allan, what do you mean about not using server side processing? I set the ajax source for datatable but I set the word "test" for each column to test whether datatable could render correctly or not
  • bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
    I just saw that fnRender is deprecated, is it the reason? I put the debug from firebug on the line
    [code]
    return "test";
    [/code]

    , have no idea why firebug does not jump into that line
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > I just saw that fnRender is deprecated, is it the reason?

    No - fnRender will still work in 1.9. It is removed in 1.10.

    > what do you mean about not using server side processing?

    You haven't enabled server-side processing ( bServerSide ), so those parameters mean nothing to DataTables - they aren't used at all, since you are using client-side processing ( http://datatables.net/usage/server-side ).

    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Ah - I was wrong, or missed it:

    > "bServerSide": true

    You do you server-side processing. In which case your JSON return is wrong. sEcho should never ever be 0. It starts at 1 and increments by one for each draw. Also iDisplayRecords and iTotalDisplayRecords should be integers and not strings.

    Allan
  • bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
    It works now :D. A little bit confused since the server side for the v1.8.1 used sEcho with 0. I changed iDisplayRecords and iTotalDisplayRecords into strings because of this (http://www.datatables.net/release-datatables/examples/data_sources/server_side.html) :(
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > the server side for the v1.8.1 used sEcho with 0

    Sounds like a bug that was fixed ;-)

    Good to hear you've got it working now.

    Allan
  • bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
    thank you very much :)
This discussion has been closed.