首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在sencha touch中垂直滚动?

问如何在sencha touch中垂直滚动?
EN

Stack Overflow用户
提问于 2013-06-12 18:17:30
回答 2查看 9.6K关注 0票数 2

我使用的是sencha touch carousel,其中我使用的是水平滑动。它工作得很完美。但在这里面,我使用的是我想要垂直滚动的面板(将每一页滚动到底部)。如何做到这一点?我在每个面板中给出了滚动:‘垂直’,如下所示:

代码语言:javascript
复制
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 touch vertical scroll content in a horizontal carousel。根据这个堆栈溢出的答案,我们可以在水平旋转木马中垂直滚动子内容,和我一样。但我在这里做了同样的事情,我不能滚动。我的子面板包含vbox和hbox布局。

有人能回答我的问题吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-06-17 14:16:34

试试这个,它对我很有效,我是从sench forum买的

在面板中设置的可滚动配置

代码语言:javascript
复制
scrollable : {
      direction     : 'vertical',
      directionLock : true
}

示例

代码语言:javascript
复制
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]...............});

查看此fiddle

票数 7
EN

Stack Overflow用户

发布于 2013-06-17 14:04:08

编辑:如果你想在你的面板中使用'hbox‘,你需要在容器中适应它的宽度。

如果它需要创建自己的滚动条,它将无法这样做。

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

代码语言:javascript
复制
scrollable: {
    direction: 'vertical',
    directionLock : true
}

如下所示:

代码语言:javascript
复制
    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 docs的任何实时预览中尝试此功能

希望这能有所帮助

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17062986

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档