Using datetables with REST API, not able to get the complete data in table
Using datetables with REST API, not able to get the complete data in table
Thanks to Allan for making this great pluggin. I am stuck with a strange issue. I am requesting data from 3 different REST services, calling second in success function of 1st one by passing an attribute retrieved from first REST service and similarly calling the 3rd REST service in the success of 2nd. All of these are ajax calls ($.ajax and rest two $.getJSON).
I am forming a html table dynamically using the data obtained from these calls and then applying datatables by using a setTimeOut() after 600ms after all the data is received. Since this method would not scale up if the amount of data is large and loading may take time.
Since, this takes some time and user can notice the change to datatable, I tried to apply datatables in the success function of the 1st ajax call but it only displays first 10 rows and rest of the table does not get populated with data.
I want to use a solution which is clientside oriented, please suggest a way to make it work since I am relatively new to datatables.
I am forming a html table dynamically using the data obtained from these calls and then applying datatables by using a setTimeOut() after 600ms after all the data is received. Since this method would not scale up if the amount of data is large and loading may take time.
Since, this takes some time and user can notice the change to datatable, I tried to apply datatables in the success function of the 1st ajax call but it only displays first 10 rows and rest of the table does not get populated with data.
I want to use a solution which is clientside oriented, please suggest a way to make it work since I am relatively new to datatables.
This discussion has been closed.
Replies
Can you not just initialise the table in the Ajax callback function after you have put the HTML table in place? Presumably you have a function which is inserted the table into the DOM? Just call DataTables immediately after that, and on most browsers there shouldn't be a flash between the table types :-).
Allan
Thanks for the quick reply. I have tried working on the suggestion that you have mentioned above. Immediately after creating the table dynamically in the success of 1st ajax call, I'am initializing datatables with my settings. I cannot notice the transition from html table to dataTables but it is only showing first 10rows of the data and rest of it does not get populated, as you might have seen I have mentioed the same thing in my query above. I will post the code if needed.
Please suggest a work around or is it possible to achieve this by some other method may be server side processing. I have to request 2 REST APIs instead of 3 now.
Allan