Functions fnDraw and fnReloadAjax works partially - Not drawing/update view

Functions fnDraw and fnReloadAjax works partially - Not drawing/update view

ericvvfericvvf Posts: 2Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
Hi, dear friends. I'm trying to update my table every time a button is clicked. For this, i googled and the sources showed me two functions: fnDraw and fnReloadAjax. I have tried both of them, and the response from the server was ok, just like the first ajax call. It was the first call (GET) when the page loaded:

[code]

http://sigac/financeiro/arquivosRemessas?sEcho=1&iColumns=2&sColumns=&iDisplayStart=0&iDisplayLength=2&mDataProp_0=0&mDataProp_1=1&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&iSortCol_0=0&sSortDir_0=asc&iSortingCols=1&bSortable_0=true&bSortable_1=true&_=1394716175634

[/code]

And the response: [code]{"sEcho":1,"iTotalRecords":"2","iTotalDisplayRecords":"2","aaData":[["dmy","34"],["2014-03-12 00:00:00","34"]]}[/code]

Then purposely i've changed my database to obtain a different query result. When the button is clicked the ajax request is done and it returns the right data:

The request:
[code]
http://sigac/financeiro/arquivosRemessas?sEcho=2&iColumns=2&sColumns=&iDisplayStart=0&iDisplayLength=2&mDataProp_0=0&mDataProp_1=1&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&iSortCol_0=0&sSortDir_0=asc&iSortingCols=1&bSortable_0=true&bSortable_1=true&_=1394716175635
[/code]

The response:
[code]{"sEcho":1,"iTotalRecords":"1","iTotalDisplayRecords":"1","aaData":[["dmy","34"]]}[/code]

But my table does not redraw!
Below is my piece of code:
[code]
var oTable = $('#sample_1').dataTable({

"bProcessing": false,
"bServerSide": true,
"sServerMethod": "GET",
"sAjaxSource": "http://sigac/financeiro/arquivosRemessas",
"iDisplayLength": 2,
"aaSorting": [[0, 'asc']],
"aLengthMenu": [
[2, 4, 6, -1],
[2, 4, 6, "Todos"]
],

});

$('#btn-create-remessa').on('click',function(){
//oTable.fnReloadAjax();
oTable.fnDraw();
})
[/code]
I do not know what else to do. Can anyone help me?
Thanks in advance!

Replies

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    > "sEcho":1

    This is wrong in the second request. Please see the server-side documentation here: http://datatables.net/usage/server-side

    Allan
  • ericvvfericvvf Posts: 2Questions: 0Answers: 0
    Wow! I just change something in my server-side!
    Thanks, Allan!! It works like a charm!!
This discussion has been closed.