日期:2014-05-16  浏览次数:20519 次

ExtJs的问题
我想在Id为LeaveFormRequire的div中放一个FormPanel
问题是:renderTo:LeaveFormRequire,在页面中显示不出表单信息,脚本报错,而如果用renderTo:Ext.getBody()则能显示,但我需要在LeaveFormRequire中显示,求解!(该页面套用了母版页)
C# code

<%@ Page Language="C#" MasterPageFile="~/Views/Forms/Form.master" AutoEventWireup="true"
    CodeFile="LeaveForm.aspx.cs" Inherits="Views_Forms_LeaveForm" Title="假条申请" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../../Js/ExtJs-3.2.0/resources/css/ext-all.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="../../Js/ExtJs-3.2.0/adapter/ext/ext-base.js"></script>

    <script type="text/javascript" src="../../Js/ExtJs-3.2.0/ext-all.js"></script>

    <script type="text/javascript">
  Ext.onReady(function(){ 
        var LeaveForm = new Ext.form.FormPanel({
       width:350,
       frame:true,
       [color=#FF0000]renderTo:LeaveFormRequire,//呈现[/color]       title:"填写请假单",
       bodyStyle:"padding:5px 5px 0",
       items:[
          {
            fieldLabel:"UserName",
            xtype:"textfield",
            name:"user",
            id:"user",
            width:200
          },
          {
            fieldLabel:"PassWord",
            xtype:"textfield",
            name:"pass",
            id:"pass",
            width:200
          }
       ],
       buttons:[{text:"确定"},{text:"取消"}]
    });
});
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPH" runat="Server">
    <div id="LeaveFormRequire">
    </div>
</asp:Content>




------解决方案--------------------
你的顺序放错了!
<script>
。。。。。。。
</script>
放在你的
<div id="LeaveFormRequire">
</div>
下面!因为它执行js时找不到你的“LeaveFormRequire”所以就显示不了!

------解决方案--------------------
top top
------解决方案--------------------
探讨
你的顺序放错了!
<script>
。。。。。。。
</script>
放在你的
<div id="LeaveFormRequire">
</div>
下面!因为它执行js时找不到你的“LeaveFormRequire”所以就显示不了!

------解决方案--------------------
页面中:<div style="width:600px;" id="search-panel">
在JS的formPanel当中: applyTo: 'search-panel'