Sencha Touch: Disable scrolling for a Panel, List, or DataView?

吃可爱长大的小学妹 提交于 2019-12-23 13:08:32

问题


I see that panels have the option to set scroll: to horizontal or vertical, but is there any way to do something like: scroll: 'false'? I've tried such without luck.

I have a DataView nested in a Panel. I can set the scroll direction of each independently, but I want the DataView not to scroll at all.

[Any tips will earn answer points and a digital high five. Heck, I'll even throw in a bonus high SIX!]


回答1:


Okay, turns out by fudging around a bit (as I've learned to do with poorly documented Sencha Touch) that disabling the scroll can be done as follows:

scroll: false

Note the absence of single or double quotes when setting scroll: to false. The values horizontal and vertical, however can be done with single or double quotes.




回答2:


I think this relates to the fact that in javascript, strings (e.g. 'false', "false") are evaluated to true if not null. So "false", 'false', "true", 'true', 'junk', 'absce' all evaluate to true. So by setting the attribute value scroll:'false' or scroll:"false" it is actually setting it to true. Using the non-quoted false on the other hand is actually passing a proper boolean false value.




回答3:


For Sencha Touch 2 users scroll can be disabled using the following config:

config: {
   scrollable: false
}

http://docs.sencha.com/touch/2-1/#!/api/Ext.Panel-cfg-scrollable




回答4:


You should setScrollable to false for your component.

Here is the example:

//'.items' CSS class or other selector
var itemsId = pageEl.up('.items').id;

//Find component
var itemsCmp = Ext.getCmp(itemsId);

//You can skip two previous lines in case you already have needed component
itemsCmp.setScrollable(false);


来源:https://stackoverflow.com/questions/6602107/sencha-touch-disable-scrolling-for-a-panel-list-or-dataview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!