Cache Prevention for Dojo xhr requests

 * Cache Prevention for Dojo xhr requests
 * Adds no-cache header and enables dojo's preventCache feature
 * for every dojo xhr call. This prevents the caching of partial
 * refreshs.
 * @author Sven Hasselbach
 * @version 0.3
        if( !dojo._xhr )
        dojo._xhr = dojo.xhr;
        dojo.xhr = function(){        
                var args = arguments[1];   
                args["preventCache"] = true;
                args["headers"] = { "cache-control": "no-cache" };
                arguments[1] = args;
        	dojo._xhr( arguments[0], arguments[1], arguments[2] );

This small snippet prevents caching of all Dojo's xhr request (which includes Partial Refreshs)
Just add it the code to a <xp:scriptBlock> on your XPage.

See here for more details:

JavaScript (Client)
Sven Hasselbach
January 23, 2013 5:33 AM

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.

1 comment(s)Login first to comment...
Panu Haaramo
(at 05:28 on 28.01.2013)
Using this breaks the DataGrid: