【问题标题】:Call other component Sencha Touch / Javascript调用其他组件 Sencha Touch / Javascript
【发布时间】:2014-05-02 08:10:57
【问题描述】:

我想创造一些非常简单的东西,但我不知何故为此苦苦挣扎。

它在 Sencha Architect 3 中工作,但它给我带来了问题,所以我正在尝试 CMD 方式。 在 Architect 中我创建了一个控制器,但由于某种原因这不起作用。

所以我正在尝试一个简单的监听器。

我的问题是如何从 Button Tap 事件中调用“MyContainer”,因为“Refreshing...”没有出现?

我试过了:

MyContainer.setHtml('刷新...');

但这给了我:Uncaught ReferenceError: MyContainer is not defined

我也试过了:

this.getMyContainer().setHtml('Refreshing...');

Uncaught TypeError: undefined is not a function

还有这个:

Ext.getElementById('MyContainer').setHtml('Refreshing...');

Uncaught TypeError: undefined is not a function

这是我的 MainView.js

Ext.define('WebChat.view.Main', {

extend: 'Ext.tab.Panel',
xtype: 'main',
requires: [
    'Ext.TitleBar',
    'Ext.Button'
],
config: {

 itemId: 'MainView',
        items: [
            {
                xtype: 'titlebar',
                docked: 'top',
                itemId: 'topBar',
                title: 'Obec Webchat',
                items: [
                    {
                        xtype: 'button',
                        action: 'back',
                        id: 'BackButton',
                        itemId: 'BackButton',
                        margin: '5 70% 5 15',
                        ui: 'back',
                        text: 'Home'
                    }
                ]
            },
            {
                xtype: 'container',
                docked: 'top',
                height: '100%',
                html: '<iframe src="someurl" width="100%" height="100%" scrolling="yes"></iframe>',
                itemId: 'MyContainer',
                width: '100%'
            }
        ],
        listeners: [
            {
                fn: 'onBackButtonTap',
                event: 'tap',
                delegate: '#BackButton'
            }
        ]
    },

onBackButtonTap: function(button, e, eOpts) {
    Ext.getElementsByTagName('MyContainer').SetHtml('Refreshing...');
}

提前致谢。

【问题讨论】:

    标签: javascript extjs sencha-touch sencha-touch-2


    【解决方案1】:

    用途:

    this.down('#MyContainer').setHtml('Foo');

    只是编造方法名看看它们是否有效(Ext.getElementsByTagName)并不是一个好主意。

    【讨论】:

    • 感谢工作! :D getElementsByTagName 在 Sublime Text 的代码完成中。
    【解决方案2】:

    试试Ext.get('MyContainer').update('Refreshing...');

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多