0

Sencha2 で作業中... html 内のリンクを押して新しいビューを開くにはどうすればよいですか? このようなもの:

Main.js

Ext.define('SkSe.view.Main', {
extend: 'Ext.tab.Panel',
xtype: 'main',
requires: [
    'Ext.TitleBar',
    'Ext.dataview.List'
],
config: {
   tabBarPosition: 'bottom',

    items: [
        {
            xtype: 'home'
        },
        {
            xtype: 'placesContainer'
        },
        {
            xtype: 'favoriti'
        },
        {
            xtype: 'live'
        }
    ]
}});

ホーム.js

Ext.define('SkSe.view.Home', {
extend: 'Ext.Panel',
xtype: 'home',

config: {
    title: 'home',
    iconCls: 'home',
    layout: 'fit',
    styleHtmlContent: true,
    styleHtmlCls: 'homeView',

    html:[
        '<div class="cubePanel">Go to akcije.js</div>',
        '<div class="cubePanel">Go to live.js</div>',
        '<div class="scanPanel"></div>',
        '<div class="cubePanel">Go to favoriti.js</div>',
        '<div class="cubePanel">Go to map.js</div>'
    ].join("")

}});

Akcije.js

Ext.define('SkSe.view.Akcije', {
id: 'akcije',
extend: 'Ext.Panel',
xtype: 'akcije',

config:{

    title:'Akcije',
        iconCls:'maps',
        layout:'fit',
        items:[
        {
            xtype:'list',
            store:'Places',

            itemTpl:
                '<img src="resources/icons/{icon}"></img>' +
                    '<h1>{name:ellipsis(25)}</h1>' +
                    '<p>Besplatan desert.</p>' +
                    '<p># {stamps}</p>',

            itemCls:'place-entry'
        }

    ]
}});

基本的に、カスタムのホーム画面が必要で、いくつかのアイコン ( Go to * *.js* が現在表示されている場所) をタップすると、対応するビューが開きます。

4

1 に答える 1

0

が定義されていると仮定すると、Controller次のようなことができます。

コントローラー

Ext.define('SkSe.view.MyController', {
    extend: 'Ext.app.Controller',
    //...other stuff here...
    openMyView: function(jsFile) {
        Ext.Viewport.add({ xtype: 'akcije' });
    }
});

次に、次のようにリンクを定義します。

html: [
    '<div class="cubePanel"><a href="#" onclick="SkSe.app.getController(\'MyController\').openMyView(\'akcije.js\'); return false;">Go to akcije.js</a></div>',
    //...more here...
]
于 2013-06-26T13:15:53.087 に答える