refresh dataTables after closing a popup?

refresh dataTables after closing a popup?

ocin35ocin35 Posts: 15Questions: 2Answers: 0

hi,
how to refresh dataTables after closing a popup please?
Thank you

Replies

  • colincolin Posts: 5,560Questions: 0Answers: 971

    Hi @ocin35 ,

    You can try draw(),

    Cheers,

    Colin

  • ocin35ocin35 Posts: 15Questions: 2Answers: 0

    Thank you colin
    what I do not understand is where to copy the complementary code so that it is taken into account (in my exit code of my popup?)
    Cheers,

  • ocin35ocin35 Posts: 15Questions: 2Answers: 0
    edited March 20

    Hi,
    my code to open a popup window

    is it possible to specify a value to a variable then use setTimeout (function () {activated according to the value of the variable?

    if no, would there be another solution?

    please

    $('#items').on( 'click', 'td', function (e) {
    if (table.column( $( this )).index() == 1) {
    jsID = table.row( $(this).parents('tr') ).data()["ID"];
    //open popup
    window.mypopup = window.open('Modif.php?numAGU='+jsID,'Modifier','directories=0,titlebar=0,toolbar=0,location=0,status=0, menubar=0,scrollbars=no,resizable=no, top=500, left=500, width=500, height=500');
    }
    } );

  • awelchawelch Posts: 37Questions: 1Answers: 3

    You can use an event listener on the unload event. Using jquery it would look something like this:

    $('#items').on( 'click', 'td', function (e) {
      if (table.column( $( this )).index() == 1) {
      jsID = table.row( $(this).parents('tr') ).data()["ID"];
      //open popup
      window.mypopup = window.open('Modif.php?numAGU='+jsID,'Modifier','directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no, top=500, left=500, width=500, height=500');
      }
      $(window.mypopup).on("unload", function(){
        //put your refresh code here, it will be different based on how your table is set up
        //Example if you're using ajax sourced data:
        table.ajax.reload();
      });
    } );
    
  • ocin35ocin35 Posts: 15Questions: 2Answers: 0

    it works :-)
    thanks a lot awelch for your help

Sign In or Register to comment.