Redesenhar datatables depois de usar ajax para atualizar o conteúdo da tabela?

Redesenhar datatables depois de usar ajax para atualizar o conteúdo da tabela?

joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
edited November 2013 in General
Como posso redesenhar datatables depois de usar ajax para atualizar o conteúdo da tabela?

Replies

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    How are you updating the table via Ajax at the moment? As noted in the forum rules, please link to a test case.

    Also this is a predominantly English forum - you are far more likely to get help if you pose your questions in English, even if you just run them through Google translate.

    Allan
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    Ok Allan...

    $(document).ready(function() {
    var oTable = $('#tbleitos').dataTable( {
    "bPaginate": false,
    "bLengthChange": false,
    "bFilter": false,
    //CLASSIFICAÇÃO DE COLUNAS
    "bSort": false,
    "bInfo": false,
    //LARGURA INTELIGENTE DA COLUNA
    "bAutoWidth": false,
    "aoColumns" : [ {
    "sWidth": "10px"},
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null],

    "bProcessing": false,
    "bServerSide": true,
    //ATUALIZAÇÃO EM REAL-TIME
    "sAjaxSource": "consulta_cirurgias.php?sEcho=1" } );

    setInterval(function()
    {
    //oTable.fnReloadAjax("consulta_teste.php?sEcho=1");
    oTable.fnDraw();
    //$('table.dataTable td').css('font-size', 70);
    },120000);

    } );
  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    I think using the fnReloadAjax plug-in is what you want to do. Why is it commented out?

    Allan
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    Comentei porque estou em dúvida. Preciso carregar dados de uma tabela e depois de outra, com intervalo de tempo. É como se o botão para a próxima página funcionasse automatica, sem a necessidade de clicar em cima.
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    I commented because I'm in doubt. I need to load data from a table and then another, with time interval. It's as if the button for the next page to work automatically, without the need to click on.
  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    > ?sEcho=1

    That is wrong.

    Also, thinking about it, just use fnDraw since you have server-side processing enabled.

    Allan
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    Allan,

    I want to display two different tables each minute. Can I use FnDraw?
  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    edited November 2013
    That sounds a lot like your other post - can we please just have one thread on that topic, otherwise I'll get confused and we'll waste everyone's time.

    What was wrong with the method of showing two different tables?
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    edited November 2013
    ok...
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    I am not able to display two different tables. I need it to display a data table and after two minutes appears another table and stay in the loop. I need to be more specific. Show me how to develop my code.
  • joao_oliveirajoao_oliveira Posts: 32Questions: 0Answers: 0
    edited November 2013
    ok?
This discussion has been closed.