2012-07-13 79 views
0

我有难度设置上的隐藏事件的元素(面板)的HTML在煎茶触摸2.Ext.getCmp不工作YouTube上的视频煎茶的隐藏触摸

删除一个iFrame的Youtube视频隐藏事件正在工作,并被调用,因为我有一个Ext.Msg.alert在被调用的隐藏功能,它的工作原理,但我不能停止隐藏视频。

这是我的面板的代码:

Ext.define('TCApp.view.MyPanel0', { 
extend: 'Ext.Panel', 
alias: 'widget.mypanel0', 

config: { 
    hideOnMaskTap: true, 
    scrollable: false, 
    items: [ 
     { 
      xtype: 'panel', 
      html: '<iframe width="560" height="315" src="http://www.youtube.com/embed/-gv9RicOHNQ" frameborder="0" allowfullscreen></iframe>', 
      itemId: 'videopanel', 
      hideOnMaskTap: true 
     } 
    ] 
} 

});

在我的控制器我有这样的:

Ext.define('TCApp.controller.MyController', { 
extend: 'Ext.app.Controller', 
config: { 
    control: { 
     "#dataview": { 
      itemtap: 'onDataviewItemTap' 
     }, 
     "mypanel0": { 
      hide: 'onVideopanelHide' 
     } 
    } 
}, 

等等

这:

onVideopanelHide: function(component, options) { 
    Ext.Msg.alert('Test onhide event'); <-- working hide event called 

    Ext.getCmp('videopanel').setHtml(""); 
    Ext.getCmp('videopanel').setHtml('<div id="video1"><iframe width="560" height="315" src="http://www.youtube.com/embed/NSUucup09Hc?fs=1&amp;hl=en_US&amp;rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe></div><img src="resources/images/thapelo3Fy.jpg" />'); 

} 

的Ext.getCmp没有工作,虽然,我得到的错误:“类型错误:'undefined'不是对象(评估'Ext.getCmp('videopanel').setHtml')'

面板I a试图设置HTML上有一个'视频面板'的itemid,所以我不知道什么是错的。有任何想法吗?

我仍然在隐藏事件上播放我的iFrame Youtube视频,我想将其完全删除。

我也试过'Ext.getCmp('videopanel')。destroy();'但是我得到了与上面相同的错误。我只有ITEMID设置为videopanel并没有其他IDS ...提前为任何帮助

谢谢...

回答

1

嘿@Digeridoopoo只是一个改变成MyPanel0,

代码

itemId: 'videopanel', 

到:

id: 'videopanel', 

我做了一个类似于这样的代码和山姆的代码在您的控制器上使用onVideopanelHide方法。

Ext.define('myapp.view.MyPanel0', { 
    extend: 'Ext.Panel', 
    xtype: 'mypanel0', 

    config: { 
     hideOnMaskTap: true, 
     scrollable: false, 
     items: [ 
     { 
      xtype: 'panel', 
      html: '<iframe width="560" height="315" src="http://www.youtube.com/embed/-gv9RicOHNQ" frameborder="0" allowfullscreen></iframe>', 
      id: 'videopanel', 
      hideOnMaskTap: true 
     }, {html: '<br/>'}, 
     { 
      xtype: 'button', 
      text: 'Change Video', 
      width: '55%', 
      handler: function() { 
       Ext.getCmp('videopanel').setHtml('') 
       Ext.getCmp('videopanel').setHtml('<div id="video1"><iframe width="560" height="315" src="http://www.youtube.com/embed/NSUucup09Hc?fs=1&amp;hl=en_US&amp;rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe></div><img src="app/images/home.png" />') 
      } 
     }, {html: '<br/>'}, 
     { 
      xtype: 'button', 
      text: 'Video Stop', 
      width: '55%', 
      handler: function() { 
       Ext.getCmp('videopanel').hide() 
      } 
     } 
    ] 
    } 
}); 

我希望这有助于。 :)

enter image description here

enter image description here

enter image description here

+0

唉唉这样的itemid是问题!现在,Ext getCmp对我来说更加清晰。我一直在摆弄这一段时间,非常感谢+1 :-) – Digeridoopoo 2012-07-15 09:00:38