Javascript Sencha touch:工具栏未正确滚动
我有一个这样创建的工具栏-Javascript Sencha touch:工具栏未正确滚动,javascript,sencha-touch-2,Javascript,Sencha Touch 2,我有一个这样创建的工具栏- toolbar = new Ext.Toolbar({ docked: 'bottom', scrollable: {direction: 'horizontal', directionLock: true}, hidden: true, item
toolbar = new Ext.Toolbar({
docked: 'bottom',
scrollable: {direction: 'horizontal', directionLock: true},
hidden: true,
items: thumbItems
});
我正在使用以下代码滚动它-
toolbar.getScrollable()
.getScroller()
.scrollTo(scrollUnit * scrollAmount,
0, {type: 'slide', duration: '1000', easing: 'linear'});
当工具栏可见时,它工作正常。如果在隐藏工具栏时执行此代码,则滚动条不会滚动。我可以在控制台中看到这段代码正在执行,但是滚动条并没有从它的位置移动
这里出了什么问题?这可能是因为Sencha Touch 2中不推荐您创建工具栏的方式 你应该这样做:
Ext.create('Ext.toolbar',{
docked: 'bottom',
scrollable: {direction: 'horizontal', directionLock: true},
hidden: true,
items: thumbItems
});
希望这能有所帮助。这种创建组件的方法在ST2中已被弃用。使用Ext.create('Ext.toolbar',CONFIG_对象)@Tdebaileul:卷轴在工作!哇,我没想到!请写下这个作为答案,这样我就可以接受了!哈哈,也没想到:)