Ajax loading executed before the entire layout is completed
Ajax loading executed before the entire layout is completed
SorinS
Posts: 1Questions: 1Answers: 0
Description of problem: I am using Datatables 2.1, with server-side ajax data loading. I want to create a select element in the topEnd section of the layout and use the selected option as a parameter for the ajax call. But when I load the page the value of the select element is undefined, because the layout code was not yet executed. Is there a way to postpone the ajax call until the entire layout is completed?
Answers
I have a similar situation but I don't have the select element inside the data table's layout. If you have it outside the table's layout there shoud be no issues.
Example: I am passing the startDate to the server for the ajax call which is based on a select field which is above the data table.
If you are using server side processing, ie
serverSide
enabled, you might be able to usedeferLoading
. Once the option is selected then usedraw()
to fetch the page viaajax
.Or if you want to initially load the data via
ajax
or are using client side processing then just send a default value if the select option isundefined
.Kevin