2014-07-10 26 views
0

我用一個jQuery數據表插件 表是這樣的,當由螢火蟲發射的錯誤面向:jQuery的數據表類型錯誤:b爲null

    <table id="dt_cursuri" class="table table-striped table-bordered dTableR"> 
         <thead> 
          <tr> 
           <th data-class="expand">Curs</th> 
           <th data-hide="phone,tablet" data-name="Assign">Domeniu</th> 
           <th>Tip</th> 
           <th>Data modif</th> 
           <th class="centered-cell">Actiuni</th> 
          </tr>         
         </thead> 
         <tbody> 
          <tr> 
           <td class="dataTables_empty" colspan="6">Fetching data from server</td> 
          </tr> 
         </tbody> 
        </table> 

的數據表初始化:

 var oTable; 
     var responsiveHelper = undefined; 
     var breakpointDefinition = { 
      tablet: 1024, 
      phone : 480 
     }; 
     var oTable = $('#dt_cursuri'); 

     oTable = $('#dt_cursuri').dataTable({ 
      "bProcessing": true, 
      "bServerSide": true, 
      "sPaginationType": "bootstrap", 
      "sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>", 
      "sAjaxSource": "view/cursuri/server_side.php", 
      autoWidth : false, 
      "fnPreDrawCallback": function() { 
       // Initialize the responsive datatables helper once. 
       if (!responsiveHelper) { 
        responsiveHelper = new ResponsiveDatatablesHelper(oTable, breakpointDefinition); 
       } 
      }, 
      "fnDrawCallback" : function (oSettings) { 
       responsiveHelper.respond(); 
      }, 
      "fnRowCallback": function(nRow, aData) { 
       responsiveHelper.createExpandIcon(nRow); 
      },           
      "aoColumns": [ 
       //{ "sClass": "center", "bSortable": false, sWidth: '2%', "bVisible": false }, 
       { sWidth: '35%' }, 
       { sWidth: '25%' }, 
       { sWidth: '20%' }, 
       { sWidth: '10%' }, 
       { "sClass": "center", sWidth: '10%', "bSortable": false } 
      ],    
      "aaSorting": [[2, 'asc']] 
     }); 

服務器端json文件正在正常工作。相同的代碼用於其他工作表完美,但這不是

有人可以幫我嗎? 錯誤時,會引發該行從jquery.datatables.js:

!a.sLoadingRecords && (c && 'Loading...' === b.sLoadingRecords) && D(a, a, 'sZeroRecords', 'sLoadingRecords'); 

回答

2

我會回答這個問題,我自己感謝jQuery的數據表的開發人員。 問題出在服務器端處理。當使用變音符號時,數據表與數據搞混了,所以你必須用utf8_encode()php函數實際控制變音符號