Initializing Datatable in a Modal after page loads with server side ajax post data
Initializing Datatable in a Modal after page loads with server side ajax post data
![richb78uk](https://secure.gravatar.com/avatar/ec25aad42bf1d76aebd74f54c50ffcd3/?default=https%3A%2F%2Fvanillicon.com%2Fec25aad42bf1d76aebd74f54c50ffcd3_200.png&rating=g&size=120)
Hi,
Just wondering if there is something obvious I'm missing. I've used datatables all over with ajax data server side processing etc, and I've got a modal opening and then calling initialising code for the datatable, however when I try to access the form data for server side paging in my controller (asp.net core) like so
var draw = Request.Form["draw"].FirstOrDefault();
var start = Request.Form["start"].FirstOrDefault();
var length = Request.Form["length"].FirstOrDefault();
(I've used this when using datatables not loaded in a modal) it says it can't evaluate Form until all threads have run and bombs out with any error message.
I assume its because it loaded after the page load, anyone got any ideas to solve this?
Thanks
Richard
Answers
Hi @richb78uk ,
I'm not familiar with asp.net, but could you set those variables in the table's
initComplete
function - that way the table will be initialised and the data loaded.Cheers,
Colin
For some reason just adding a parameter to the controller method fixes and form variables are present