Visual Studio 2010のMVC3 Webアプリケーションでテーブルフォルダーが動作しません。Visual Studio 2010のMVC3 Webアプリケーションでテーブルフォルダーが動作しない
問題を再現するには、次の
- オープンのVisual Studio 2010
- 新しいASP.NET MVC 3 Webアプリケーションを作成
で閲覧/共有/ _Layout.cshtmlを交換してください:
<!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> @* This doesn't work and I don't know why *@ <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.tablesorter.min.js")" type="text/javascript"></script> @*This works*@ @*<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> *@ </head> <body> <div class="page"> <div id="main"> @RenderBody() </div> </div> </body> </html>
Views/Home/Index.htmlを次のように置き換えます。
<h2>debug jquery Kano</h2> <p> testing </p> <table id="theTable" class="tablesorter"> <thead> <tr><th>Tic</th><th>Tac</th><th>Toe</th></tr> </thead> <tbody> <tr><td>o</td><td>o</td><td>x</td></tr> <tr><td>x</td><td>o</td><td>o</td></tr> <tr><td>o</td><td>x</td><td>x</td></tr> </tbody> </table> <script type="text/javascript"> // $(function() { // alert("$: jQuery found!"); // }); $(document).ready(function() { $("#theTable").tablesorter(); }); </script>
http://tablesorter.comからjquery.tablesorter.min.jsをダウンロードし、/ Scriptsディレクトリに置きます。
- アプリをビルドして実行します。
Index.cshtmlのtablesorter呼び出しがうまく実行されないようです。
ありがとうございました!
乾杯、 ケビン