Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

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

$
0
0
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:


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


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

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:
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

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

But my table does not redraw!
Below is my piece of 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();
    })
I do not know what else to do. Can anyone help me?
Thanks in advance!

Viewing all articles
Browse latest Browse all 1816

Trending Articles