Reputation: 479
define(function(require, exports, module){
var View = require('src/core/View');
var Surface = require('src/core/Surface');
var ScrollContainer = require('src/views/ScrollContainer');
function ListView(){
View.apply(this, arguments);
_createContent.call(this);
}
ListView.prototype = Object.create(View.prototype);
ListView.prototype.constructor = ListView;
ListView.DEFAULT_OPTIONS = {
data: []
}
function _createContent(){
var sc = new ScrollContainer();
var sequence = [];
sc.sequenceFrom(sequence);
for (var i = 0; i < this.options.data.length; i++) {
var surface = new Surface({
content: this.options.data[i].name,
size: [undefined, 40],
properties: {
borderBottom: '1px solid #000',
padding: '10px 15px'
}
});
sequence.push(surface);
};
this.add(sc);
}
module.exports = ListView;
});
As you read from the title, my problem is Famo.us ScrollContainer is not scrolling. The above code is used to add a scrollable list. This module is then included in a PageView. The PageView is included in the MainView which has a RenderController to show or hide the pages. The list is showing along with the data being passed to this module. The only problem is the Scrolling. Any ideas?
Upvotes: 2
Views: 68
Reputation: 14353
The surface
needs to pipe events to the ScrollContainer
.
for (var i = 0; i < this.options.data.length; i++) {
var surface = new Surface({
content: this.options.data[i].name,
size: [undefined, 40],
properties: {
borderBottom: '1px solid #000',
padding: '10px 15px'
}
});
surface.pipe(sc); // Pipe the Surface events to the ScrollContainer
sequence.push(surface);
};
Upvotes: 1