how to refresh table after an operation ?

how to refresh table after an operation ?

mlotfimlotfi Posts: 60Questions: 5Answers: 0

Hi,
I have a datatable, the first column show agencies assigned to this row, in another column I have a button that when clicked show a form to assign new agencies to this row, everything work well, but for the new agencies added I have to refresh the page to see them, is there any way to add them as soon as I click the button "Assign" ?

here is an image showing what I am talking about :

http://s18.postimg.org/9xtvp7w6x/rr_Agency.png

Thanks.

Replies

  • mlotfimlotfi Posts: 60Questions: 5Answers: 0

    I used :
    oTable.fnDraw();
    but did not work.


    $("#divPopUp").dialog({ resizable: true, autoOpen: false, height: 500, width: 550, modal: true, buttons: { "Assign": function () { var agenciesId = $(this).find(":checkbox:checked").map(function () { return this.value; }).get(); //alert("agenciesId :" + agenciesId); var ruleIDd = $("#divPopUp").data('param_1'); $.ajax({ url: 'assignRenameRuleToAgency.do', data: {"agenciesId": agenciesId,"ruleId":ruleIDd }, success: function(response) { toastr.success(response.message); oTable.fnDraw(); } }) $(this).dialog("close"); }, Cancel: function () { $(this).dialog("close"); } }, close: function () { $(this).find(":checkbox").removeAttr('checked'); $(this).dialog("close"); } });

    My table is not getting data from json, just iteration a bean coming from the server side :

    var oTable = $('#ListTable').DataTable({
            "bStateSave": true, 
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",
            "bAutoWidth": false,
            "aoColumnDefs": [
            {
                "bSearchable": false, 
                "aTargets": [0, 5,6,7,8]
                },
                {
                "bSortable": false, 
                "aTargets": [0, 5,6,7,8]
                },
                 { "bVisible": false, "aTargets": [10] } 
            ]
        });
    
    
  • mlotfimlotfi Posts: 60Questions: 5Answers: 0

    I even used this :

    fnStandingRedraw

    from : http://www.datatables.net/plug-ins/api/fnStandingRedraw

    but does not work too.

This discussion has been closed.