how to refresh after changing filtering?

how to refresh after changing filtering?

FicosFicos Posts: 88Questions: 22Answers: 0

Hi Allan,
Looks good this new version.
http://localhost/oostveen-advies-secure/client10/ix_client.html?id=ij2etetemb3kvr6d8uoc80nap7
there is a button "Relatie". When pushed the filtering should change. I need to redraw the table, but I haven't an idea how. Do I need to add an event listener? I am using the TableTools button.

This question has an accepted answers - jump to answer

Answers

  • FicosFicos Posts: 88Questions: 22Answers: 0

    In addition to this: the button "wijzigen" seems to react the same as "Relaties" in stead of bringing up a dialog form....

  • allanallan Posts: 61,746Questions: 1Answers: 10,111 Site admin

    It's this code that you want to replace is it:

    $('#client06').dataTable().fnReloadAjax();

    In DataTables 1.10 it has a built in ajax reload function - the ajax.reload() method. So all you need to do is:

    $('#client06').dataTable().ajax.reload();
    

    And it will reload the data from the source.

    In addition to this: the button "wijzigen" seems to react the same as "Relaties" in stead of bringing up a dialog form....

    I think the issue here is this part:

      $.fn.dataTable.TableTools.buttons.edit_record = $.extend(
        true,
        $.fn.dataTable.TableTools.buttonBase,
    

    You need to extend an empty object, otherwise it is extending the buttonBase object, and properties will get mixed up. So use:

      $.fn.dataTable.TableTools.buttons.edit_record = $.extend(
        true, {},
        $.fn.dataTable.TableTools.buttonBase,
    

    The sNewRecord and sRelatie button types also appear to suffer from the same issue, while the order ones are correct.

    Regards,
    Allan

  • FicosFicos Posts: 88Questions: 22Answers: 0

    Ok, thank you.
    But I let the filtering do by DataTables I should not need to reload from server? All data is available, there is only a new filter active (Relaties, Archief)

  • FicosFicos Posts: 88Questions: 22Answers: 0

    $('#client06').dataTable().ajax.reload();
    results in :

    TypeError: $(...).dataTable(...).ajax is undefined

  • allanallan Posts: 61,746Questions: 1Answers: 10,111 Site admin
    Answer ✓

    $('#client06').dataTable().ajax.reload(); results in :

    My mistake - it should be:

    $('#client06').DataTable().ajax.reload();
    

    !

    Allan

  • FicosFicos Posts: 88Questions: 22Answers: 0
    edited May 2014

    Thank you

This discussion has been closed.