0

以下は、私のextjs4MVCアプリケーションのルートアプリケーションファイルであるJavaScriptファイルです。

私はこれらの指示に正確に従い、WebサーバーとしてIIS 7を使用しました:http:
//docs.sencha.com/ext-js/4-1/# !/ guide / application_architecture

そして、次の手順に従ってフレームワーク用にIISを構成します:
http ://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p = 229858&viewfull = 1#post229858

ASP.NETユーザーコントロール(ascxファイル)を取得してページに追加したいと思います。すでに登録されていますが、Senchaフレームワークが私のページにあるものを引き継いで無視しているようです。MVCチュートリアルにあるindex.htmlファイルを取得し、それをaspxページにして、いくつかのマイナーな調整を行いました。コントロールを表示するにはどうすればよいですか?それが不可能な場合は、このapp.jsファイルをascxファイル内で参照して(そしてapp.jsではなくcontrol_x.jsに名前を変更して)、そのユーザーコントロール(ascx)と他のコントロール(現在は機能していない)を固定することをお勧めしますか? )ASP.NET(aspx)ページに移動しますか?基本的に、アプリケーション全体でこのフレームワークに依存するのではなく、自分で構築したくないコントロールだけに依存します。

app.js:

Ext.application({
    requires: ['Ext.container.Viewport'],
    name: 'AM',
    appFolder: 'app',

    controllers: [
        'Users'
    ],

    launch: function () {
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',

            items: {
                xtype: 'userlist'
            }

        });
    }
});

Users.js(コントローラー):

Ext.define('AM.controller.Users', {
    extend: 'Ext.app.Controller',

    stores: [
        'Users'
    ],

    models: [
        'User'
    ],

    views: [
        'user.List',
        'user.Edit'
    ],

    init: function () {
        console.log('Initialized Users! This happens before the Application launch function is called');
        this.control({
            'viewport > panel': {
                render: this.onPanelRendered
            },
            'viewport > userlist': {
                itemdblclick: this.editUser
            },
            'useredit button[action=save]': {
                click: this.updateUser
            }
        });
    },

    onPanelRendered: function() {
        //console.log('The panel was rendered');
    },

    editUser: function(grid, record) {
        //console.log('Double clicked on ' + record.get('name'));
        var view = Ext.widget('useredit');
        view.down('form').loadRecord(record);
    },

    updateUser: function(button) {
        //console.log('clicked the Save button');
        var win    = button.up('window'),
            form   = win.down('form'),
            record = form.getRecord(),
            values = form.getValues();

        record.set(values);
        win.close();
        // synchronize the store after editing the record
        this.getUsersStore().sync();
    }

});
4

1 に答える 1

1

ここでの答えはパフォーマンスです。アプリケーションにJavaScriptを使用している場合は、すべてを同じページに保持してください。そうしないと、ページを切り替えるときにJavaScriptを再ロードする必要があります。

于 2012-09-07T04:16:34.947 に答える