jQuery数据库被“处理” [英] jQuery Datatables Stuck on "Processing"

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

问题描述

更新:根据评论中的建议,我已经更新了数据表编码以使用mRender和mData方法。我仍然有下面同样的问题。代码已更新以反映更改



我遇到的问题非常奇怪。当我加载一个在本地使用jQuery数据表的页面时,表格正确填写。当我将页面移动到我的远程主机时,数据表只显示处理框,从不加载数据。本地,我正在运行WAMP服务器,托管服务器正在运行Linux。要将另一个曲线球放在那里,它在远程服务器上的DID功能,但突然停止工作,而不对代码或服务器设置进行任何更改。没有任何错误提醒。



以下是数据表的代码:

  $ ).ready(function(){
$(#properties)。dataTable({
bProcessing:true,
bServerSide:true,
sPaginationType :full_numbers,
bAutoWidth:false,
sAjaxSource:index.php?option = com_protools& task = anlypropertiesajax& tmpl = component,
aoColumns
{mData:0,mRender:function(data,type,full){
return< a href ='。$ module。'?task = anlyShowprop& propid = + data +>+ data +< / a>;
}
},
{mData:function(source,type,val){$ b $返回< a href ='。$ module。'?task = anlyShowprop& propid =+ source [0] +>+ source [1] +< / a> ;
}
},

{mData:function(source,type,val){return source [2] +< br /> + source [3] +,+ source [4] + < br /> + source [5];}},
{mData:7},
{mData:8},
{mData 9},
{mData:10},
{mData:11},
{mData:12},
{mData:13},
{mData:14}
]
});
});

返回的JSON是有效的(在 http ://jsonlint.com/ )。



任何关于为什么表将在本地填充但不在远程服务器上的想法?任何想法都会很大赞赏。

解决方案

如果您也使用后台页面,也许您可​​以解决这个问题:
当你返回到寻呼信息的数据结构,您可以将返回的sEcho重置为0,如下所示:
例如:

  dataSource.setsEcho(0); //我尝试设置0,这对我来说可以尝试
dataSource.setA aData(tempList);
dataSource.setiTotalDisplayRecords(totalNum);
dataSource.setiTotalRecords(totalNum);


UPDATE: Per the suggestions in the comments, I have updated the data table coding to use the mRender and mData methods. I am still having the same issue outlined below. The code has been updated to reflect the change

The issue I am having is very strange. When I load a page that uses jQuery datatables locally, the table populates correctly. When I move the page to my remote hosting the datatable only shows the "Processing" box and never loads the data. Locally, I am running WAMP server, the hosted server is running Linux. To throw another curve ball out there, it DID function on the remote server, but suddenly stopped working without any changes made to the code or server setup. There is no alert for any errors.

Here is the code for the datatables:

$(document).ready(function() {
$("#properties").dataTable( {
  "bProcessing": true,
  "bServerSide": true,
  "sPaginationType": "full_numbers",
  "bAutoWidth": false,
  "sAjaxSource": "index.php?option=com_protools&task=anlypropertiesajax&tmpl=component",
  "aoColumns":[
            { "mData":"0", "mRender": function ( data, type, full ) {
            return "<a href='.$module.'?task=anlyShowprop&propid=" + data + ">" + data + "</a>";
              }
           },
          { "mData": function ( source, type, val ) { 
              return "<a href='.$module.'?task=anlyShowprop&propid=" + source["0"] + ">" + source["1"] + "</a>";
             }
    },

          { "mData": function ( source, type, val ) { return source["2"]+ "<br />" + source["3"] + ", " + source["4"]+ "<br /> "+source["5"];}},
          { "mData":"7"},
          { "mData":"8"},
          { "mData":"9"},
          { "mData":"10"},
          { "mData":"11"},
          { "mData":"12"},      
          { "mData":"13"},
          { "mData":"14"}   
       ]
} );
} );

The JSON returned is valid (validated on http://jsonlint.com/).

Any thoughts on why the table would populate locally, but not on the remote server? Any ideas would be greatly appreciated.

解决方案

If you also use the background page,Maybe you can solve this problem like this: When you return to the data structure of the paging information,You can reset the returned sEcho to 0,like this: eg:

    dataSource.setsEcho(0);//I try set 0,It's work for me,you can try
    dataSource.setAaData(tempList);
    dataSource.setiTotalDisplayRecords(totalNum);
    dataSource.setiTotalRecords(totalNum);

这篇关于jQuery数据库被“处理”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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