0

必要な特定のビューを指すカスタム メニュー (html またはボタンを使用しますが、"Ext.tab.Panel" としてではありません) が必要です。クリックでビューを変更できましたが、別の問題が発生しました...

アプリを最初に実行すると、すべて正常に動作します... ..アプリが起動します..アイテムのリストがある[表示]をクリックします...アイテムをクリックすると、詳細を含む別のビューがプッシュされます。動作しますか?動作します!:)

.....しかし、ここに問題があります: - リストを持つビュー (Ext.NavigationView) に移動し、そこから「ホーム」アイコンを押して「Main.js」ビューに戻ると、 「ホーム」(予想どおり)-同じリストに再度移動するリンクをクリックすると、アイテムのリストが表示されますが、そのアイテムの詳細を再度開くことはありません(これを表示するために別のビューをプッシュしたことを思い出してください) )

誰かが私を助けることができますか?私は何を間違っていますか?

ここに私のアプリのいくつかのコードがあります:

コントローラー/詳細.js

Ext.define('SkSe.controller.Details', {
extend: 'Ext.app.Controller',

config: {

    refs: {
        placesContainer:'placesContainer'
    },
    control: {
        //get me the list inside the places which is inside placesContainer
        'placesContainer places list':{
            itemsingletap:'onItemTap'
            //itemtap:'onItemTap'
        }

    }
}
,
onItemTap:function(list,index,target,record){

    console.log('You clicked an item');


    this.getPlacesContainer().push({
        xtype:'details',
        title:record.data.name,
        data:record.data
    })


}

});

コントローラー/Main.js

Ext.define('SkSe.controller.Main', {
extend: 'Ext.app.Controller',

config: {
    control: {
        //define the name of the function to call when button is pressed
        homeButton: {tap: 'goToHome'},
        liveButton: {tap: 'goToLive'}
    },

    refs: {
        //button must have action='something' for reference
        homeButton: 'button[action=goToHome]',
        liveButton: 'button[action=goToLive]'
    }
},

//以下のすべての関数を定義します

goToHome: function() {//called whenever the button is tapped
    //debug for tapping. See in console what buton you tapped so we can assign some action
    console.log('You clicked on a button that goes to Home (trouble!)');

    Ext.Viewport.animateActiveItem({xtype: 'main'},{type: 'slide',direction: 'left'});


},

goToLive: function() {//called whenever the button is tapped
    //debug for tapping. See in console what buton you tapped so we can assign some action
    console.log('You clicked on a button that goes to Live');

    Ext.Viewport.animateActiveItem({xtype: 'live'},{type: 'slide',direction: 'left'});

}

});

ビュー/PlacesContainer.js

Ext.define('SkSe.view.PlacesContainer',{
extend:'Ext.NavigationView',
xtype:'placesContainer',


config:{
    items:[
        {
            xtype:'places'

        },
        {
            xtype:'toolbar',
            docked:'bottom',

            items: [
                {
                    xtype: 'button',
                    title: 'Go to Akcije (placesContainer)',
                    iconCls: 'icon-akcije',
                    action:'goToHome'
                },
                {
                    xtype: 'button',
                    title: 'Go Live (live.js)',
                    iconCls: 'icon-live',
                    action:'goToLive'
                }
            ]

        }


    ]
}

});

ビュー/Places.js

Ext.define('SkSe.view.Places',{
extend:'Ext.Panel',
xtype:'places',

config:{

    autoLoad:true,

    title:'Akcije',
    iconCls:'icon-akcije',
    layout:'fit',
    items:[

        {
            xtype:'list',
            store:'Places',

            itemTpl:'<img src="resources/icons/{icon}"><h1>{name:ellipsis(25)}</h1><h3>{stamps}</h3>',
            itemCls:'place-entry'
        }
    ]
}

});

4

1 に答える 1

0

記述的でない参照を使用すると、これに似た問題が発生します。ボタンに ID を追加し、それによってそれらを参照してみてください。

すなわちhomeButton: '#homeButton'

于 2013-07-18T21:24:15.870 に答える