2010-03-31 24 views
3

我開發了一個非常簡單的MVC應用程序來測試出trirand的jqGrid for MVC。jqGrid - 在jquery選項卡中打開的問題(在Firefox和Google Chrome上)

該應用程序會打開一個jQuery標籤組的jqGrid和一切都確定了IE瀏覽器。然而,當我使用Firefox jqgrid只在偶爾在第一個標籤中打開(而不是在任何其他標籤下),並且在Chrome中,我的jqgrid不會在該組的任何選項卡下打開。

我有點MVC的新手(和只被檢測出的jqGrid了幾天),但我知道我的用戶將要使用不同的瀏覽器。 Trirand沒有回答任何答案,所以想知道其他人是否也有過類似的問題。

我確實只是實現的jqGrid按照控制器和模型中對Trirand現場示例應用程序,然後用一個簡單的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> 
+0

有3個不同版本的jqGrid - ASP.NET MVC,PHP和純JavaScript。這聽起來像你正在使用ASP.NET MVC的 - 你能澄清一下嗎?另外,一些代碼可能會有幫助。 – 2010-03-31 14:30:00

+1

道歉...... Trirand不是Telerind(它已經很漫長了) – 2010-03-31 14:30:27

+0

我的標籤組通過標準的jquery腳本調用; <腳本類型= 「文本/ JavaScript的」> $(函數(){$( '#標籤')的選項卡();}); 在我使用;

  • <%= Html.ActionLink( 「GridChildren」, 「GridDemo」,新的{控制器= 「網格」,ID = Model.FamilyID})%>
  • 要使用網格控制器。網格控制器包含;
    <%= Html.Trirand().JQGrid(Model.FamiliesChildrenGrid, "JQGrid1") %>
    2010-03-31 14:39:38

    回答

    0

    這是一個位在黑暗中刺的,因爲我沒有使用過jqGrid-ASP.NET,但你可以嘗試初始化網格時,標籤是準備好了,從標籤的show事件:

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

    謝謝Justin,現在就試試這個。 – 2010-03-31 16:22:09

    相關問題