I have been scouring the web trying to find an elegant solution and have not been able to find anything on the subject but we have an ajax source for our data, I want to make a load more button at the bottom of the page and once the button is pressed it loads 'x' more results from the server and appends it to the end of the table. We need to use an ajax source to still have the ability to search our database without having to load all results to our page everytime.
What I've tried:
I have an ajax function that submits info to our backend and returns a correctly formed JSON array with the exact data I want: 'x' records starting one element after our last in the table. What I do not know is how to append this to the current table. I've tried sending the results to the table using fnAddData(json.aaData, true) or fnAddData(json.aaData, false) followed by fnDraw() it looks like it works correctly but my network tab in chrome developer tools shows me that two ajax calls are returning, one that I made with the correct info and one that datatables made which pull all the results already on the table+'x' new results. I need to know how to prevent datatables from making the sequential call (I imagine part of fnDraw() ) and how to append my results (JSON) to the end of the table. Any suggestions?
This might help: ehejaq (datatables debug)
What I've tried:
I have an ajax function that submits info to our backend and returns a correctly formed JSON array with the exact data I want: 'x' records starting one element after our last in the table. What I do not know is how to append this to the current table. I've tried sending the results to the table using fnAddData(json.aaData, true) or fnAddData(json.aaData, false) followed by fnDraw() it looks like it works correctly but my network tab in chrome developer tools shows me that two ajax calls are returning, one that I made with the correct info and one that datatables made which pull all the results already on the table+'x' new results. I need to know how to prevent datatables from making the sequential call (I imagine part of fnDraw() ) and how to append my results (JSON) to the end of the table. Any suggestions?
This might help: ehejaq (datatables debug)