Read() without cache

3 posts, 0 answers
  1. Kevin
    Kevin avatar
    112 posts
    Member since:
    Jul 2011

    Posted 21 Jun 2012 Link to this post

    I have a problem that when we datasource.read() it gets cached data and not up-to-date data from the server.
    Of course it seems that it only does it in internet explorer... firefox works fine.

    We send a query string with a random number to keep the request from getting cached data.
    GridData = new kendo.data.DataSource({
         transport: {
                read: {
                    url: buildAsyncUrl('GetData'),
                    dataType: "json",
                    data: JSON.stringify(GridFilters)
                }
            },
            ......
    });

    function buildAsyncUrl(cont) {
        return cont + '/?nocache=' + Math.random();
    }

    //whenever we need to refresh the grid we call:
     
    GridData.read();


    If you profile it it firefox:
    1rst request:   ?nocache=0.36012812319771115
    2nd request:   ?nocache=0.5465367197402407
    3rd request:   ?nocache=0.5722005265817256

    If you profile it in IE:
    1rst request:   ?nocache=0.6602959470869887
    2nd request:   ?nocache=0.6602959470869887
    3rd request:   ?nocache=0.6602959470869887

    How can I keep the datasource.read() from reusing the same value (url) it had when first called or initiated??
    Or is there any "no cache" like option?
  2. Kevin
    Kevin avatar
    112 posts
    Member since:
    Jul 2011

    Posted 21 Jun 2012 Link to this post

    I have a solution for my case; Since we use asp.net mvc we added a nocache to our application controlloer class.

    [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
    public class AppController : Controller{}

    I suppose this is more of an application/browser issue but still curious if kendo datasource has and caching options I am not finding...
  3. Traci
    Traci avatar
    12 posts
    Member since:
    Jan 2012

    Posted 19 Sep 2012 Link to this post

    thanks a million for this...

    I just had this same problem and happened to locate this particular thread which saved me a lot of time.

    I added the same workaround that you did and everything worked fine for me as well (ie, we're using IE only).
Back to Top