2016-10-28 3 views
0

に異なる書式設定されたのはなぜ私のWebページにはでテーブルのように見えない:これは私のページですはなぜ私の書式設定のJQuery.Datatableは、ドキュメント

https://datatables.net/examples/basic_init/zero_configuration.html

@{ 
    Layout = null; 

} 

<!DOCTYPE html> 

<html> 
@*<head> 
    <meta name="viewport" content="width=device-width" /> 
    <title>Employee Index Page</title> 
</head>*@ 
<body> 
    <div> 
     <h1>Employee Index Page</h1> 
     <table id="example" class="display" cellspacing="0" width="100%"> 
      <thead> 
       <tr> 
        <th>Symbol</th> 
        <th>ActualPosition</th> 
        <th>AccountIdent</th> 
       </tr> 
      </thead> 
      <tbody> 

       @{ 
        var categories = (DataTable)ViewData["MyData"]; 

        foreach (DataRow item in categories.Rows) 
        { 
         string symbol = item.Field<string>("Symbol"); 
         string actualPositionText = item.Field<long>("ActualPosition").ToString(); 
         string accountIdent = item.Field<string>("AccountIdent"); 

         <tr> 
          <td>@symbol </td> 
          <td>@actualPositionText</td> 
          <td>@accountIdent </td> 
         </tr> 
        } 
       } 
      <tbody> 
     </table> 
     <script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.12.3.js"></script> 
     <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> 
     <script> 
      $(function(){ 
      $("#example").dataTable(); 
      }) 
     </script> 


    </div> 

</body> 
</html> 

enter image description here

答えて

0

CSSファイルを含める必要があります。

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"> 
+0

私はそのリンクをの直後に置きますが、それは何の違いもありません – ManInMoon

+0

ブラウザのコンソールにエラーはありますか? –

+0

ここで働いています[JSFiddle](https://jsfiddle.net/journeyman/8oL3Laew/) –

関連する問題