2015-01-19 1 views
0

내가 뭘 잘못하고 있는지 안내해주세요!간단한 테이블에 대해 정의되지 않은 'mData'속성을 읽을 수 없습니다.

자바 스크립트 :

<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> 
<script src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script> 
<script> 
    $(function() { 

     $('#example').dataTable({ 
      "scrollY" : 800, 
      "scrollX" : true, 
      "paging" : false, 
      "ordering" : true, 
      //"order": [[ 3, "desc" ]], 
      "info" : true, 
      "columns": [{ 
       "orderDataType": "dom-text-numeric", 
       "orderDataType": "dom-text-numeric", 
       "orderDataType": "dom-text-numeric", 
       "orderDataType": "dom-text-numeric", 
       "orderDataType": "dom-text-numeric", 
       "orderDataType": "dom-text-numeric" 
      }] 
     }); 
    }); 
</script> 

HTML :

<table id="example" style="border-collapse:collapse;" border="1"> 
     <thead>   
      <tr> 
       <th>Name</th> 
       <th>Position</th> 
       <th>Office</th> 
       <th>Age</th> 
       <th>Start date</th> 
       <th>Salary</th> 
      </tr> 
     </thead> 

     <tbody> 


      <tr> 
       <td>Tiger Nixon</td> 
       <td>System Architect</td> 
       <td>Edinburgh</td> 
       <td>61</td> 
       <td>2011/04/25</td> 
       <td>$320,800</td> 
      </tr> 
      <tr> 
       <td>Garrett Winters</td> 
       <td>Accountant</td> 
       <td>Tokyo</td> 
       <td>63</td> 
       <td>2011/07/25</td> 
       <td>$170,750</td> 
      </tr> 
     </tbody> 
    </table> 

Datatables 표 디버거 결과 :

http://debug.datatables.net/ogimac

,691,363 (210)

JSFiddle는 :

http://jsfiddle.net/sajjansarkar/pqzkx1oj/1/

답변

1
<script> 
    $(function() { 

     $('#example').dataTable({ 
      "scrollY" : 800, 
      "scrollX" : true, 
      "paging" : false, 
      "ordering" : true, 
      //"order": [[ 3, "desc" ]], 
      "info" : true, 
      "columns": [ 
       {"orderDataType": "dom-text-numeric"}, 
       {"orderDataType": "dom-text-numeric"}, 
       {"orderDataType": "dom-text-numeric"}, 
       {"orderDataType": "dom-text-numeric"}, 
       {"orderDataType": "dom-text-numeric"}, 
       {"orderDataType": "dom-text-numeric"} 
      ] 
     }); 
    }); 
</script> 

각 orderDataType는 자신의 목적에 있어야합니다. https://datatables.net/reference/option/columns.orderDataType

+0

아, 감사합니다. –

관련 문제