Refresh ajax grid not working
Refresh ajax grid not working

I have a page that I'm working on using asp.net mvc core. The page includes a datatables grid populated with an ajax source. This is working as expected. I click a button to bring up a semantic ui modal to add a new entry. This is also working as expected and the new item is added to the database.
On the success handler for the form post I want to refresh the grid. The success handler is being hit as I have verified that with an alert box. Here is the ajax call.
<script type="text/javascript">
function submitForm() {
$.ajax({
url: "/Division/CreateTableGroup",
type: "POST",
data: $("form").serialize(),
success: function(data){
$("#table_group_list").DataTable().ajax.reload();
},
error: function (response) {
alert("error")
}
});
}
</script>
Any idea why the reload might not be happening?
Answers
On initialization save the DataTable for further reuse.
Thanks for the reply. didn't help. I am compositing the page using an asp.net mvc partial view. So I have a parent page and then the div/form that makes up the modal lives in a view that I render in the page using partial view render. The end result is that they are all in the same page. Not sure that makes a difference.
meaning the table init and the submit form methods are not in the same js block
Oh I see... Yep, it is out of my scope.
I can only say that will work if in your call back you have a function that propagates to the parent. and then the parent does the call
myTable.ajax.reload();
But, as I said it is out of my scope...
rykr,
Were you ever able to figure out how to refresh the parent page when you post the partial page form?
I am trying to use a partial view as a category filter. When I GET the data the partial loads perfectly, except I am using row grouping to create "subheaders" which don't group unless the page is refreshed.