jQuery Datatables Stuck on “Processing”

穿精又带淫゛_ 提交于 2019-12-11 14:58:41

问题


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.


回答1:


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);


来源:https://stackoverflow.com/questions/18394372/jquery-datatables-stuck-on-processing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!