允许服务器端缓存在`fnServerData`的数据表 [英] Allow server-side caching in `fnServerData` in DataTables

查看:153
本文介绍了允许服务器端缓存在`fnServerData`的数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在默认情况下在数据表Ajax调用避免缓存,加入一个假的领域上的网址,例如: http://yoursite.com/api/?_348522852542。我想禁用此。看来,ajax的函数调用 fnServerData ,其定义是这样的...

By default Ajax calls in DataTables avoid caching by adding a bogus field onto the url, e.g. http://yoursite.com/api/?_348522852542'. I would like to disable this. It appears that the ajax functions call fnServerData which is defined something like this...

    "fnServerData": function ( sUrl, aoData, fnCallback, oSettings ) {
        oSettings.jqXHR = $.ajax( {
            "url":  sUrl,
            ....
            "cache": false,
            ....
            });
      };

我想要的值高速缓存,而不是。我失去了一些东西?这是为什么硬codeD中也是这样吗?就是做此更改本地或通过提交补丁编辑源代码的最佳方式?

I want the value for "cache" to be true rather than false. Am I missing something? Why is this hard-coded in like this? Is the best way to do make this change to edit the source either locally or by submitting a patch?

推荐答案

您可以覆盖fnServerData回调: HTTP ://datatables.net/usage/callbacks#fnServerData

You can override the fnServerData callback: http://datatables.net/usage/callbacks#fnServerData

这篇关于允许服务器端缓存在`fnServerData`的数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆