Does datatables cache results for an ajaxSource?

Does datatables cache results for an ajaxSource?

richieriviererichieriviere Posts: 1Questions: 1Answers: 0

Hi,

Before I start I'll just say that I have asked this question on Stack Overflow (http://stackoverflow.com/questions/30068319/does-datatables-cache-results-for-an-ajaxsource) but did not get a response so I've finally decided to join this community in search of help......

I have embedded jquery datatables inside a portlet war file web module and am experiencing some funny behaviour which I need some explanation for.

I am using an ajaxSource to load the data for all my datatables. This is what my javascript looks like...http://pastebin.com/qXpwt9A7

Here is the scenario...

I open the web application and do a keyword search on 'TextA' Result: The ajax url is myRootUrl?keyword=TextA. An ajax request is sent to the server to load the jquery datatable.

Without closing the browser I do a keyword search on 'TextB'. Result: The ajax url is myRootUrl?keyword=TextB. An ajax request is sent to the server to load the jquery datatable.

Without closing the browser I do a keyword search on 'TextA' again. The ajax url is myRootUrl?keyword=TextA. Result: A request is not sent to the server. But my datatable is smart enough to remember the results retrieved in step 1 and it displays the results on the page.

This actually works well for me but I don't know why it is happening.

If I had to guess I'm thinking there must be some smarts in datatables where it caches the results for an ajax source where the parameters are the same so that it doesn't have to fire off the request for that ajax url again.

Am I right? I am using data tables 1.9.4.

thanks in advance

This discussion has been closed.