Matt McCormick
Matt McCormick

Reputation: 13210

How to cache YUI DataSource?

I'm setting up a YUI DataTable with filtering by following the steps on the YUI site

However, I am using JSON as the DataSource ResponseType. When I type in a value to filter, the request will be sent to the server again. I find this to be wasteful as all the data has already been retrieved the first time.

Is there a way to cache the initial data returned and then filter only according to that data so another AJAX request does not have to be made?

Upvotes: 0

Views: 629

Answers (2)

Saurabh
Saurabh

Reputation: 26

You can use the YUI 3 cache utility to cache the data in javascript memory or HTML5 localstorage object. You can read more about this at http://developer.yahoo.com/yui/3/cache

Upvotes: 1

Tivac
Tivac

Reputation: 2573

http://developer.yahoo.com/yui/datasource/#caching should help.

Upvotes: 0

Related Questions