繁体   English   中英

如何在sencha touch中垂直滚动?

[英]How to scroll vertically in sencha touch?

我正在使用sencha touch轮播,其中我正在使用水平滑动。 哪个完美。 但是在这种情况下,我使用的是我想垂直滚动的面板(将每一页滚动到底部)。 怎么做? 我在每个面板中都给出了scroll:'vertical',如下所示:

var myFirstPage = Ext.Panel({
      id:'tableId',
          iconCls:'myToolBar',
          style:'overflow:auto;' ,
          scroll:'vertical',
          items:.........});
Ext.setup( {
    onReady: function() {
      myCarouselId = new Ext.Carousel({
        fullscreen: true,
        id:'myCar',

        items : [ myFirstPage]...............});

但是我不能将面板滚动到底部。 哪里出错了?

Sencha在水平轮播中触摸垂直滚动内容 根据这个stackoverflow答案,我们可以在水平轮播中垂直滚动子内容,像我这样的问题。 但我在这里做同样的事情,我不能滚动。 我的子面板包含vbox和hbox布局。

有人可以回答我的问题吗?

试试这个,它对我有用 ,我从sench论坛得到它

在Panel中设置可滚动配置

scrollable : {
      direction     : 'vertical',
      directionLock : true
}

var myFirstPage = Ext.Panel({
          id:'tableId',
          iconCls:'myToolBar',
          scrollable : {
            direction     : 'vertical',
            directionLock : true
         },
        items:.........});

Ext.setup( {
    onReady: function() {
      myCarouselId = new Ext.Carousel({
        fullscreen: true,
        id:'myCar',
        items : [ myFirstPage]...............});

看到这个小提琴

编辑:如果您希望面板中的'hbox'可用性,则需要在容器内放置其宽度。
如果它需要创建自己的滚动条,它将无法这样做。

您需要的是以不同方式定义滚动:

scrollable: {
    direction: 'vertical',
    directionLock : true
}

像这样:

    var carousel = Ext.create('Ext.Carousel', {
fullscreen: true,
items : [ 
    {  xtype: 'panel',     
       scrollable: {
         direction: 'vertical',
         directionLock: true
       },
       html: 'This panel is scrollable!',
       items: [{
                xtype: 'textfield',
                name : 'first',
                label: 'First'
            },
            {
                xtype: 'textfield',
                name : 'second',
                label: 'Second'
            },{
                xtype: 'textfield',
                name : 'third',
                label: 'Third'
            },{
                xtype: 'textfield',
                name : 'first1',
                label: 'First1'
            },
            {
                xtype: 'textfield',
                name : 'second1',
                label: 'Second1'
            },{
                xtype: 'textfield',
                name : 'third1',
                label: 'Third1'
            },{
                xtype: 'textfield',
                name : 'first12',
                label: 'First12'
            },
               { xtype: 'panel',
                layout: 'hbox',
                width: 200,
                items: [{
                    xtype: 'textfield',
                    name : 'first-box',
                    label: 'First-box'
                },
                {
                    xtype: 'textfield',
                    name : 'second-box',
                    label: 'Second-box'
                },{
                    xtype: 'textfield',
                    name : 'third-box',
                    label: 'Third-box'
                }]
           }, {
                xtype: 'textfield',
                name : 'second12',
                label: 'Second12'
            },{
                xtype: 'textfield',
                name : 'third12',
                label: 'Third12'
            }]
    }, {
       xtype: 'panel',
       scroll:'vertical',  // will not work
       html: 'This panel is not scrollable!',
    }]
});

您可以在sencha文档的任何实时预览中尝试此操作
希望这可以帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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