jqGrid - 在jquery选项卡中打开问题(在Firefox和Google Chrome上)

时间:2010-03-31 14:26:27

标签: jquery firefox jqgrid tabs jqgrid-asp.net

我开发了一个非常简单的MVC应用来测试trirand的jqGrid for MVC。

该应用程序在jquery选项卡组中打开一个jqgrid,IE的一切正常。但是,当我使用Firefox时,jqgrid只会在第一个标签中打开(但不会在任何其他标签下),而在Chrome中我的jqgrids似乎不会在该组的任何标签下打开。

我是一个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>

1 个答案:

答案 0 :(得分:0)

由于我没有使用jqGrid-ASP.NET,这在黑暗中有点刺痛,但您可以尝试在标签准备就绪时从标签的show事件中初始化网格:

$('#tabs').tabs({
    show: function(event, ui) {
        // Initialize your jqGrid in here
    }
});