// 添加第一个节点
this.root.appendChild(new Ext.tree.TreeNode({
text : '用户管理',
iconCls : 'node',
listeners : { // 在该对象初始化时便加入多个事件处理函数 
'click' : function(node, event) {
main.openTab(node, event,userinfoUserPanel)
                                 }
} }));
// 内容面板
tabContent = function() {
this.openTab = function(node, event,panel) {
event.stopEvent();
var n = main.getComponent(node.id);
if (!n) {
var p = new panel();
p.id = node.id;
p.title = node.text;
n = main.add(p);
}
main.setActiveTab(n);
};
userinfoUserPanel = Ext.extend() 该怎么写啊?我原来写的
Ext.extend(Ext.Panel, {
closable : true,
autoScroll : true,
layout : "fit",
maskDisabled : false,
gridViewConfig : {
animate : true
}
}); 运行总不对

解决方案 »

  1.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>extPanel.html</title>

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="this is my page">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="ext-2.2/resources/css/ext-all.css" />
        <script type="text/javascript" src="ext-2.2/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="ext-2.2/ext-all.js"></script>
        <script type="text/javascript">
         Ext.onReady(function () {
         var P = Ext.extend(Ext.Panel, {
         renderTo: Ext.getBody(),
         title: "panel",
         width: 200,
         height: 200,
    closable : true,
    autoScroll : true,
    layout : "fit",
    maskDisabled : false,
    gridViewConfig : {
    animate : true
    }
    });
    new P();
         });
        </script>  </head>
      
      <body>
        This is my HTML page. <br>
      </body>
    </html>
    你的没有设置renderTo,没有渲染怎么显示。还有宽度、高度
    也没有创建对象 new
      

  2.   

    var p = new panel();
    有new上面贴的只是用到的部分代码,原来的代码很长,估计没太多人会看
      

  3.   

    我理解的工作过程(部分代码段):
    main.openTab(node, event,userinfoUserPanel)然后
    main = new tabContent();再
    // 内容面板
    tabContent = function() {
    this.openTab = function(node, event,panel) {
    event.stopEvent();
    var n = main.getComponent(node.id);
    if (!n) {
    var p = new panel();    //       这里调用
    p.id = node.id;
    p.title = node.text;
    n = main.add(p);
    }
    main.setActiveTab(n);
    };上面的程序在原来的基础上没动,应该不会有错
    但是userinfoUserPanel所在的文件被我改了实现,程序就不对了,我也不知道咋改,所以请假各位大侠
    我改成这样:
    userinfoUserPanel = Ext.extend(Ext.Panel,{
    id : 'userinfoUser',
    baseUrl : 'userinfo.do',
    createForm : function() {
    var formPanel = new Ext.form.FormPanel({
    labelWidth : 80,
    frame : true,
    autoHeight : true,
    resizable : false,
    labelAlign : 'right',
    defaultType : 'textfield',
    });
    return formPanel;
    },
    createWin : function() {
    return this.initWin(280, 220, '用户信息管理');
    },
    initComponent : function() {
    userinfoUserPanel.superclass.initComponent.call(this);
    }
    });
    还是不对,到底该怎么改呢,主要就是userinfoUserPanel方法,求大侠给我一个userinfoUserPanel方法例子,万分感激
      

  4.   

    userinfoUser = Ext.extend(Ext.Panel, {
    closable : false,
    autoScroll : true,
    layout : "fit",
    maskDisabled : false,
    gridViewConfig : {
    animate : true
    }
    });// 用户管理面板
    userinfoUserPanel = Ext.extend(userinfoUser, {
    id : 'userinfoUser',
    createWin : function() {
    return this.initWin(280, 220, '管理用户信息');
    },
    initComponent : function() {
    userinfoUserPanel.superclass.initComponent.call(this);
    }
    });