trirand の jqGrid for MVC をテストするための非常に単純な MVC アプリを開発しました。
アプリはjqueryタブグループでjqgridを開き、IEですべて問題ありません。ただし、Firefoxを使用すると、jqgridは最初のタブでしか開かれず(他のタブでは開かれません)、Chromeではjqgridがグループのどのタブでも開かないように見えます。
私は少し MVC 初心者ですが (jqgrid をテストしてまだ数日しか経っていません)、ユーザーが別のブラウザーを使いたがることはわかっています。Trirand からは何の回答も得られなかったので、他の誰かが同様の問題を抱えていたのではないかと考えました。
Trirand サイトのサンプル アプリケーションのコントローラーとモデルに従って jqgrid を実際に実装し、それを簡単な jquery タブ グループと組み合わせました。
私のMVC詳細ページは次のとおりです。
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PRAMSAPP.Models.Family>" %>
<%@ Import Namespace="Trirand.Web.Mvc" %>
<%@ Import Namespace="PRAMSAPP.Controllers" %>
<%@ Import Namespace="PRAMSAPP.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/scripts/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/scripts/jquery-ui-1.7.2.custom.min.js"></script>
<fieldset>
<legend>Family</legend>
<div class="display-field"><%= Html.Encode(Model.FamilyID) %></div>
<div class="display-field"><%= Html.Encode(Model.FamilySurname) %></div>
</fieldset>
<div id="tabs">
<ul>
<li>
<%= Html.ActionLink("GridChildren", "GridDemo", new { controller = "Grid", id = Model.FamilyID })%>
</li>
<li>
<%= Html.ActionLink("Children", "ShowFamiliesChildren", new { famid = Model.FamilyID, page = Page})%>
</li>
</ul>
</div>
<p>
<%= Html.ActionLink("Edit", "Edit", new { id=Model.FamilyID }) %> |
<%= Html.ActionLink("Back to List", "Index") %>
</p>
<script type="text/javascript">
$(function() { $('#tabs').tabs(); });
</script>
</asp:Content>
And My Controller page is as follows;
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<PRAMSAPP.Models.FamiliesChildrenJqGridModel>" %>
<%@ Import Namespace="Trirand.Web.Mvc" %>
<%@ Import Namespace="PRAMSAPP.Controllers" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- The jQuery UI theme that will be used by the grid -->
<link rel="stylesheet" type="text/css" media="screen" href="/Content/themes/redmond/jquery-ui-1.7.1.custom.css" />
<!-- The Css UI theme extension of jqGrid -->
<link rel="stylesheet" type="text/css" media="screen" href="/Content/themes/ui.jqgrid.css" />
<!-- jQuery library is a prerequisite for jqGrid -->
<script type="text/javascript" src="/Scripts/jquery-1.3.2.min.js"></script>
<!-- language pack - MUST be included before the jqGrid javascript -->
<script type="text/javascript" src="/Scripts/grid.locale-en.js"></script>
<script type="text/javascript" src="/Scripts/jqgrid/jquery.jqGrid.min.js"></script>
</head>
<body>
<div>
<%= Html.Trirand().JQGrid(Model.FamiliesChildrenGrid, "JQGrid1") %>
</div>
</body>