【问题标题】:how to build an EXTJS4 mvc demo with desktop module如何使用桌面模块构建 EXTJS4 mvc 演示
【发布时间】:2012-02-03 01:45:40
【问题描述】:

我的代码可以加载Model、View、Controller,但是启动功能不起作用。

我希望桌面上的每个图标都是一个应用程序,以便在单击每个图标时加载模型、视图、控制器。如何做到这一点?

Ext.define('MyApp.GridWindow', {
    extend: 'Ext.ux.desktop.Module',

    requires: [
        'Ext.data.ArrayStore',
        'Ext.util.Format',
        'Ext.grid.Panel',
        'Ext.grid.RowNumberer'
    ],

    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){

          Ext.application({
              name: 'USER',
              appFolder: PUB+'/extjs4/mUser',
              controllers: [
                  "User"
              ],
              launch: function () {
                  win = desktop.createWindow({
                      id: 'notepad',
                      title:'Notepad',
                      width:600,
                      height:400,
                      iconCls: 'notepad',
                      animCollapse:false,
                      border: false,
                      hideMode: 'offsets',
                      layout: 'fit',
                      items: [{
                          xtype: 'htmleditor',
                          //xtype: 'textarea',
                          id: 'notepad-editor'
                       }]
                   });
               }
        });

        win.show();
        return win;
},

【问题讨论】:

    标签: extjs extjs-mvc


    【解决方案1】:

    在您的 Controller 部分尝试 (1)onLaunch 函数,或在 app.js 的最后尝试启动函数,如 (2)

    (1)

    onLaunch:function()
            {}
    

    (2)

    launch:function(){
    //runs when controllers init function is completed
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-24
      • 2021-12-30
      • 2015-03-10
      • 2022-09-24
      • 2020-11-15
      • 2013-04-14
      相关资源
      最近更新 更多