Scrollbars for VirtualList

edited March 2012 in Enyo 2
After hours of screwing around, I figured out a dirty way displaying a scrollbar for VirtualList. So far it works in my app okay. I'll post it here for the world.
Here's what you do, got to your enyo_build.js file, and edit the VirtualScroller kind. Scroll down to the section "// palm/list/VirtualScroller.js"

enyo.kind({ name: "enyo.VirtualScroller", kind: enyo.DragScroller, events: { onScroll: "" }, published: { accelerated: !0 }, className: "enyo-virtual-scroller", tools: [ { name: "scroll", kind: "ScrollStrategy", onScrollStop: "stop", //Add this topBoundary: 1e9, bottomBoundary: -1e9 } ], ........ //Add this stop: function(){ setTimeout(enyo.bind(this, function(){ if(this.$.scrollBar) this.$.scrollBar.hide(); }), 1000); }, scroll: function() { var a = Math.round(this.$.scroll.y) - this.pageOffset; if (a == this.pageTop) return; this.pageTop = a, this.updatePages(), this.doScroll(); //Add this this.$; var x = this.$.scroll.container.heights; if(!x) return; var y = 0; // you might have to edit this yourself to match the name of the array you use to populate your list. e.g. if you're using "this.results", you'll have to edit it to "this.$.scroll.container.owner.owner.results" var d =this.$$[]; var avg = 0; var j = 0; for(var i=0; i
Note: I don't use any VirtualRepeaters, so I haven't tried it out yet with VR, but I' guessing it may not work. Same thing applies to scrollers


Sign In or Register to comment.