Refresh datatable from one modal to another

Refresh datatable from one modal to another

smarthomessmarthomes Posts: 14Questions: 5Answers: 0
edited September 2015 in Free community support

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"});
        }
    });
});

'''

This discussion has been closed.