是否可以覆盖sencha touch carousel上一个和下一个功能?

时间:2013-05-27 08:44:34

标签: javascript sencha-touch carousel

我正在使用sencha touch开发移动网站。

Ext.setup( {
    onReady: function() {

      new Ext.Carousel({
        fullscreen: true,
        items: [
          {
            html: "Item1"
},
{ 
  html : "Item2"
}
]});};});

是我使用的。但是可以覆盖next()和prev()函数。其实我想在这些函数中做一些事情,然后调用parent.next()我的意思是相同的功能。 任何帮助? 我看到了链接http://www.sencha.com/forum/showthread.php?110036-Override-Method 但是我无法理解

1 个答案:

答案 0 :(得分:1)

请参阅此代码以满足您的要求。

Ext.Loader.setConfig({
    enabled: true
});

Ext.application({
    launch: function () {
        Ext.define('MyApp.view.inbox.MyInbox', {
            extend: 'Ext.Carousel',
            config: {
                itemId:'test',
                fullscreen: true,
                items: [{
                    html: "Item1"
                },{ 
                    html : "Item2"
                }]
            },
            next:function(){
                //Do your thing

                //This code will call the next in the super class
                this.callParent(arguments);
            },
            prev:function(){
                //Do your thing

                //This code will call the prev in the super class
                this.callParent(arguments);
            }
        });
        Ext.create('MyApp.view.inbox.MyInbox');
    }
});
相关问题