jQuery数据表和初始数据加载 [英] jQuery DataTables and Initial Data Load

查看:93
本文介绍了jQuery数据表和初始数据加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jQuery Datatable论坛上问了这个问题,但没有太多的帮助。如果有任何人使用jQuery数据表,并通过在请求选项时设置初始数据,并且没有将ajax调用传递到第1页,就可以正常工作。当我的sAjaxSource在init阶段设置时,它会自动将请求重新发出即使我用数据初始化它也可以加载数据。



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屋!

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