自己是做PHP的,关于JS的基本就只会获取个ID啥的,现在想用下Extjs,所以厚颜求段简单的代码。        <dt id="acc-win-shortcut">  //例子里面的
            <a href="#"><img src="images/s.gif" />
            <div>Accordion Window</div></a>
        </dt>
        <dt id="won-win-shortcut"> //我自己加的
            <a href="#"><img src="images/s.gif" />
            <div>wontao Window</div></a>
        </dt>
这段代码例子里面的能打开一个窗口,我自己加了一个,不知道怎么打开窗口,要很简单的应用就是窗口里面打开test.php这个页面。最好是个类什么的,都可以调用,我有多个,也就只是为了开窗口里面载入自己的页面
下面是sample.js,页面里面的,没有复制全,字数不够,不知道有没有帮助,希望有人能够帮忙
MyDesktop = new Ext.app.App({
init :function(){
Ext.QuickTips.init();
}, getModules : function(){
return [
new MyDesktop.GridWindow(),
            new MyDesktop.TabWindow(),
            new MyDesktop.AccordionWindow(),
            new MyDesktop.BogusMenuModule(),
            new MyDesktop.BogusModule()
];
},    // config for the start menu
    getStartConfig : function(){
        return {
            title: 'Jack Slocum',
            iconCls: 'user',
            toolItems: [{
                text:'Settings',
                iconCls:'settings',
                scope:this
            },'-',{
                text:'Logout',
                iconCls:'logout',
                scope:this
            }]
        };
    }
});/*
 * Example windows
 */
MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
    id:'grid-win',
    init : function(){
        this.launcher = {
            text: 'Grid Window',
            iconCls:'icon-grid',
            handler : this.createWindow,
            scope: this
        }
    },    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('grid-win');
        if(!win){
            win = desktop.createWindow({
                id: 'grid-win',
                title:'Grid Window',
                width:740,
                height:480,
                iconCls: 'icon-grid',
                shim:false,
                animCollapse:false,
                constrainHeader:true,                layout: 'fit',
                items:
                    new Ext.grid.GridPanel({
                        border:false,
                        ds: new Ext.data.Store({
                            reader: new Ext.data.ArrayReader({}, [
                               {name: 'company'},
                               {name: 'price', type: 'float'},
                               {name: 'change', type: 'float'},
                               {name: 'pctChange', type: 'float'}
                            ]),
                            data: Ext.grid.dummyData
                        }),
                        cm: new Ext.grid.ColumnModel([
                            new Ext.grid.RowNumberer(),
                            {header: "Company", width: 120, sortable: true, dataIndex: 'company'},
                            {header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
                            {header: "Change", width: 70, sortable: true, dataIndex: 'change'},
                            {header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'}
                        ]),                        viewConfig: {
                            forceFit:true
                        },
                        //autoExpandColumn:'company',                        tbar:[{
                            text:'Add Something',
                            tooltip:'Add a new row',
                            iconCls:'add'
                        }, '-', {
                            text:'Options',
                            tooltip:'Blah blah blah blaht',
                            iconCls:'option'
                        },'-',{
                            text:'Remove Something',
                            tooltip:'Remove the selected item',
                            iconCls:'remove'
                        }]
                    })
            });
        }
        win.show();
    }
});MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {
    id:'tab-win',
    init : function(){
        this.launcher = {
            text: 'Tab Window',
            iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('tab-win');
        if(!win){
            win = desktop.createWindow({
                id: 'tab-win',
                title:'Tab Window',
                width:740,
                height:480,
                iconCls: 'tabs',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,                layout: 'fit',
                items:
                    new Ext.TabPanel({
                        activeTab:0,                        items: [{
                            title: 'Tab Text 1',
                            header:false,
                            html : '<p>Something useful would be in here.</p>',
                            border:false
                        },{
                            title: 'Tab Text 2',
                            header:false,
                            html : '<p>Something useful would be in here.</p>',
                            border:false
                        },{
                            title: 'Tab Text 3',
                            header:false,
                            html : '<p>Something useful would be in here.</p>',
                            border:false
                        },{
                            title: 'Tab Text 4',
                            header:false,
                            html : '<p>Something useful would be in here.</p>',
                            border:false
                        }]
                    })
            });
        }
        win.show();
    }
});

解决方案 »

  1.   

    窗口里面打开test.php这个页面没明白你的意思,php一般用于后台,ext前台要与php交互的话肯定要调用啊,比如定义一个tree,就需要指明这个tree的url是test.php
    没看到你的js代码中哪里用到test.php了
      

  2.   

    不需要交互,只要利用extjs打开窗口,里面是我定义的Php页面就可以了,打开的窗口里面是框架的页面也行
      

  3.   


      window里面items:[iframe] 
    iframe里面放php 
      

  4.   

    完全不会extjs,写明白点啊哥们
      

  5.   

     <dt id="acc-win-shortcut">  //例子里面的
    acc-win-shortcut是id,看你给的代码,应该是extjs中的desktop例子。
    desktop解析的话,都是根据id来解析的,你可以看下Desktop.js中最下面的那段代码。
    打开窗口的话,主页面上可以按例子里写个
    <dt id="Test-shortcut">  //例子里面的
                <a href="#"><img src="images/s.gif" />
                <div>Test Window</div></a>
            </dt>
    然后再模仿Sample.js中的代码自己写即可。主要看这个js中的getModules方法,以及相关的子方法就行。
    另外如果要在打开的窗口中打开另外的窗口,则需要修改App.js中的initModules方法,有时间的话可以自己研究下。
      

  6.   

    不需要你说的窗口里面再开窗口那么复杂,只需要在主页面里面打开窗口就行,窗口里面是我定义要打开的页面,就像是打开一个层,里面是个框架,框架里面有我想看到的页面那样,我不是做前台的,要看那么多JS代码能看会,我也就不求助了啊里面自己带的2个例子是表格一样的东西,数据都写在JS里面,不是外部引用的,我也看不太懂,难道extjs没有通用的函数?我只是想打开一个浮动层,里面有个页面而已,对我来说就是这么理解的...
      

  7.   

    官方给的Ext的Desktop的例子,只能通过这种方式,毕竟这个只是个demo。