簡體   English   中英

轉到sencha-touch中的另一個視圖

[英]Moving to another view in sencha-touch

除了在視圖本身中編寫所有組件之外,我還提供了到我的視圖中的HTML文件的鏈接,如下所示。 我在panelActivate()上調用了sample.html。

因此,在這種情況下,我在sample.html中有一個按鈕,我想為該按鈕編寫click事件,以便從一個視圖轉到另一個視圖。 那我該怎么辦呢? 我認為這種方法行不通

Ext.define('myapp.view.Main', {
    extend: 'Ext.Panel',
    xtype: 'main',
    requires: [
        'Ext.TitleBar',
        'Ext.Video',
        'Ext.Ajax'
    ],
    config: {
        tabBarPosition: 'bottom',
        id            : 'MyPanel',
        itemId        : 'MyPanel',
        scrollable    :  true,
        listeners: [
        {
            fn: 'onMyPanelActivate',
            event: 'activate'
        }
    ],    

        items: [
            {
                title: '<div class="small_logo"></div>',

                styleHtmlContent: true,
                scrollable: true,

                html: [


                ].join("")
            }

        ]
    },

      onMyPanelActivate: function(newActiveItem, container, oldActiveItem, eOpts) {
        Ext.Ajax.request({

        scriptTag:true,
        url: ' resources/html/sample.html',
        success : function(response) {
           Ext.getCmp('MyPanel').setHtml(response.responseText);

        },
        failure : function(response) {  
            var text = response.responseText;
            Ext.Msg.alert('Error', text, Ext.emptyFn);            }
    });

}});

它對框架的錯誤使用,但是可以使用jquery並在onMyPanelActivate成功時編寫click事件來完成。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM