[FIXED] serverside doesn't reload datas

[FIXED] serverside doesn't reload datas

l.bajardl.bajard Posts: 4Questions: 0Answers: 0
edited December 2009 in General
Hye there, very nice app you done thanks!

I'm trying to apply your simple serverside example, it loads my datas at the initialisation, but when i want to reload it, by sorting for example, the table doesn't redraw.

[code]
$(document).ready(function(){



$('#test').dataTable({
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": "getRessources.php",
"fnDrawCallback": alert("redraw")
} );
});
[/code]

I'm using firebug wich tell me that i get the server response with JSON datas correctly formatted.

But the fnRedrawCallback doesn't fire any event, and the "processing..." message stay visible.
I'm not js pro so i don't know where to look out for my mistake, so if you have any idea to solve the problem...


One more thing, i tried to disable bServerSide, the redraw callback is fired before the redraw, i mean when th table is still empty, is it the normal behaviour?

Replies

  • pktmpktm Posts: 27Questions: 0Answers: 0
    Hi!

    I guess you need to declare that function thing:
    [code]
    $(document).ready(function(){
    $('#test').dataTable({
    "bServerSide": true,
    "bProcessing": true,
    "sAjaxSource": "getRessources.php",
    "fnDrawCallback": function() { alert("redraw"); }
    } );
    });
    [/code]

    This way, it worked for me.

    hth, Alex
  • l.bajardl.bajard Posts: 4Questions: 0Answers: 0
    Nice dude it solved the callback problem, thank you.

    Anyway the serverside still doesn't work :/
  • pktmpktm Posts: 27Questions: 0Answers: 0
    Hi!

    Try using firefox with firebug plugin to check what data is sent to the server and what is the response. There is sometimes only a detail missing, e.g. e value that is not set and causes bad json or something like that.

    You may record the data from firebug (c&p) that is transfered between the server side and datatables and post it here.

    regards, Alex
  • l.bajardl.bajard Posts: 4Questions: 0Answers: 0
    Yep here they are:

    [code]
    {"sEcho":1, "iTotalRecords":24, "iTotalDisplayRecords":24, "aaData": [ ["","1","Beaune","192.168.0.13","Click to edit","1"],["","22","Beaune","192.168.0.1","","2"],["","21","Beaune","192.168.0.12","","1"],["","18","Beaune","192.168.0.1","","2"],["","17","Beaune","192.168.0.12","","1"],["","14","Beaune","192.168.0.1","","2"],["","13","Beaune","192.168.0.12","","1"],["","10","Beaune","192.168.0.1","","2"],["","9","Beaune","192.168.0.12","","1"],["","2","Beaune","192.168.0.1","","2"],["","6","Beaune","192.168.0.1","","2"],["","5","Bron","192.168.0.12","Click to edit","1"],["","3","Bron","192.168.0.105","3430","1"],["","15","Bron","192.168.0.105","3430","1"],["","7","Bron","192.168.0.105","3430","1"],["","23","Bron","192.168.0.105","3430","1"],["","11","Bron","192.168.0.105","3430","1"],["","19","Bron","192.168.0.105","3430","1"],["","20","Versailles","192.168.2.25","","2"],["","4","Versailles","192.168.2.25","","2"],["","8","Versailles","192.168.2.25","","2"],["","16","Versailles","192.168.2.25","","2"],["","12","Versailles","192.168.2.25","","2"],["","24","Versailles","192.168.2.25","","2"] ]}
    [/code]

    I found something else.
    I tried to load Allan's example datas and it works, besides, in IE6, when i try to load my datas, i've got an error, and it works with Allan's datas.
    So i think this is more a JSON encoding problem, i run a wamp server on windows, i tried to put a json header before printing my datas in php, but it doesn't solve it.
    Any idea?
  • l.bajardl.bajard Posts: 4Questions: 0Answers: 0
    Stop searching for me, i found it...
    I was printing sEcho as a fixed value, instead of the GET value, so ... MY BAD.

    Thanks for the nice and quick help anyway.
This discussion has been closed.