简体   繁体   中英

Moving to another view in sencha-touch

Instead of writing all the components in the view itself, ,i have given a link to a HTML file in my view like below. I called sample.html on panelActivate().

So in this case, i have a button in sample.html and i want to write click event for that button for going from one view to another. So how will i do that? I think this method wont work

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事件来完成。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM