Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82207

Refresh datatable from one modal to another

$
0
0

I have a datatable that pulls its data from ajax and is in a dynamically created modal.

When you click on one of the rows a new modal is created that allow you to edit that rows data.

When the update button is pressed I want to update the row, refresh the datatable and close the modal.

Everything works except the datatable refresh.

I have tried varying types of calls for the refresh like: proposal_table.api().ajax.reload(); as well as others.

Here is the code:

''' $.ajax({ type: "post", url: "/cfcs/db_items.cfc?method=updateItem", data: $('#item_form').serialize(), success: function(result) {

            $('#proposal_table').dataTable().api().ajax.reload();
            $('#proposal_table').dataTable().api().draw();

            toastr.success("Item has been updated.","Success!",{"positionClass": "toast-top-left"});
            $('#item_form_modal').modal('hide');

        },
        error: function(xhr, status, text){
            toastr.error(text,"Error!",{"positionClass": "toast-top-left"});
        }
    });
});

'''


Viewing all articles
Browse latest Browse all 82207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>