jQuery数据表和初始数据加载 [英] jQuery DataTables and Initial Data Load
问题描述
http://datatables.net/forums/discussion/6459/load-initial-data-without-ajax-call#Item_3
$(document).ready(function ){
$('#example')。dataTable({
bProcessing:true,
bServerSide:true,
sAjaxSource:scripts / server_processing。 php,
iDeferLoading:57
});
});
更新:我只是在论坛中阅读你的问题。也许你的问题毕竟不是那么简单,但是我需要看到你的数据表设置,以便给你一个更明智的意见。
我在生产环境中使用数据表,我知道一些API;但是再一次,没有看到你的设置和了解你的第二个ajax电话的处理方式,很难帮助。我会在这里留下这个答案,值得一提。
I asked this question on the jQuery Datatable forum but it wasnt much help. If anyone has worked with jQuery datatables and got it to work by setting the initial data when requesting the options, and not having the ajax call go out for page 1. When my sAjaxSource is set during the init stage it automatically makes the request out again to load the data even though I initialized it with data.
http://datatables.net/forums/discussion/6459/load-initial-data-without-ajax-call#Item_3
I think you are looking for the iDeferLoading feature.
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php",
"iDeferLoading": 57
} );
} );
UPDATE: I just read your question in the forum. Perhaps your problem is not so simple after all, but I would need to see your datatables set up in order to give you a more informed opinion.
I use datatables in a production environment and I know a bit about the API; but again, without looking at your setup and understanding exactly what's the deal with your second ajax call, it's difficult to help. I'll leave this answer here for what it's worth.
这篇关于jQuery数据表和初始数据加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!