Как создать демоверсию EXTJS4 MVC с настольным модулем - PullRequest
1 голос
/ 03 февраля 2012

Мой код может загрузить Модель, Вид, Контроллер, но функция запуска не работает.

Я хочу, чтобы каждый значок на рабочем столе был приложением, чтобы при нажатии на него можно было загружать модель, вид, контроллер. Как это сделать?

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;
},

1 Ответ

0 голосов
/ 20 июня 2013

try (1) onLaunch Function в разделе «Контроллер» или функция запуска в самом конце вашего app.js, вроде (2)

(1)

onLaunch:function()
        {}

(2)

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