2017-07-06 27 views
0

我正在成功地从服务器获取JSON对象。但是当我使用,以显示与jQuery的数据表中的数据,它显示了这个警告:DataTables警告:表id = StudentTable - 针对第0行,第0列请求未知参数“0”

数据表警告:表ID = StudentTable - 请求的未知参数“0” 0行,列0

当我点击确定,然后显示没有数据的行。我该如何解决这个问题?

下面是代码

@section scripts{ 
 
    <script type="text/javascript"> 
 
     $(document).ready(function() { 
 
      $("#StudentTable").dataTable({ 
 
       ajax: { 
 
        url: "/Students/GetAllStudents", 
 
        type: "POST", 
 
        dataType: "JSON" 
 
        
 
       }, 
 
       serverSide: "true", 
 
       processing:"true", 
 
       column: [ 
 
        { 
 
         data: "StudentName" 
 
        }, 
 
        { 
 
         data: "Registration" 
 
        }, 
 
        { 
 
         data: "DeptName" 
 
        }, 
 
        { 
 
         data: "Email" 
 
        }, 
 
        { 
 
         data: "Date" 
 
        }, 
 
        { 
 
         data: "Seasson" 
 
        }, 
 
        { 
 
         data: "Address" 
 
        }, 
 
        { 
 
         data: "ContactNo" 
 
        }, 
 
        { 
 
         render:function(data, type, students) { 
 
          return "<a href='/Students/edit/" + students.StudentId + "'> Edit</a>"; 
 
         } 
 
        } 
 
       ] 
 

 
      }); 
 

 
     }); 
 
    </script> 
 
}
<table id="StudentTable" class="table"> 
 
     <thead> 
 
      <tr> 
 
       <th>Student Name</th> 
 
       <th>Reg No</th> 
 
       <th>Department</th> 
 
       <th>Email</th> 
 
       <th>Date</th> 
 
       <th>Seasson</th> 
 
       <th>Address</th> 
 
       <th>Contact No</th> 
 
       <th></th> 
 
      </tr> 
 
     </thead> 
 
     <tbody></tbody> 
 
    </table>

回答

0

误差意味着数据表是无法获得的数据为一个小区。

您拼写错误的选项名称,应该是columns,而不是column

这个错误有很多其他的原因,可能的解决方案在这个technical note解释。

+0

谢谢@ Gyrocode.com 该问题现已解决。 –

相关问题