问题描述
在默认情况下在数据表Ajax调用避免缓存,加入一个假的领域上的网址,例如: http://yoursite.com/api/?_348522852542
。我想禁用此。看来,ajax的函数调用 fnServerData code>,其定义是这样的...
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 A>
You can override the fnServerData callback: http://datatables.net/usage/callbacks#fnServerData
这篇关于允许服务器端缓存在`fnServerData`的数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!