Datatables not showing new data

Datatables not showing new data

ikvarmaikvarma Posts: 8Questions: 0Answers: 0
edited July 2011 in General
Hi

I am using dataTables, v1.7.6. I am using sAjaxSource to have the data loaded with ajax.

When I add some new data to the database and when i refresh the page it says "Showing 1 to 10 of 292 entries (filtered from 293 total entries)"

The total count is updated but it is displaying only up to 292.

I have also tried using fnAddData but it also does the same.

Also, If I want to use fnAddData, do it add data based on the current sort or will it add at the end of the table ?

Thanks in advance

FYI: The way i am initializing the table is

"bStateSave" : true,
"bProcessing": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bServerSide": true,
"sAjaxSource": "media/list",// temp to test
"aoColumns": [
{
"fnRender": function (oObj) {
return '

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    [quote]ikvarma said: "bServerSide": true[/quote]

    You are using server-side processing, so fnAddData will do very little... It will add the data on the client-side, and then redraw the table. But since the server doesn't know about the new data, it will redraw it without the new data... fnAddData doesn't know anything about your server-side process (if you are using an SQL engine or what) so it can't add the new row to the server data store - you need to do that manually with an Ajax call. Then just call fnDraw() to reload the table display with the new data from the server.

    Allan
  • ikvarmaikvarma Posts: 8Questions: 0Answers: 0
    Thanks allan
This discussion has been closed.