When using fnReloadAjax does not remain on the current page

Asked

Viewed 21 times

0

I’m using the fnReloadAjax for when the user does some action in the table that is mounted using the datatables already reload the data again, only it does not remain on the current page.

It keeps the filter, the sort, the amount of records per page, but always goes back to the first page.

Does anyone know anything to fix this?

1 answer

0


For that question I even opened one Download on the github about this problem in plugins page Datatables also and there suggested me to use the method ajax.Reload() and that’s what solved my problem, but remembering that this function is only available from version 1.10 of datatables and for it to work really had to do so:

var oTable = $('#example').DataTable( {
    ajax: "data.json"
});

// na chamada de uma ação, qdo precisar recarregar o conteúdo da tabela fiz assim
oTable.api().ajax.reload(null, false);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.