enyo.kind({
name: "Books",
classes: "onyx",
components: [
{kind: "onyx.Toolbar", components: [
{content: "All books"},
]},
{kind: "Scroller", components: [
{kind: "Repeater", rows: 0, ontap:"bookTap", onSetupRow: "setupBookList",
components: [{name:"book",content: "item"}]}
]}
],
books : [ ],
setupBookList: function (inSender, inEvent){
var idx = inEvent.index;
inEvent.row.$.book.content = this.books[idx].name_cn;
enyo.log(this.books);
},
bookTap: function (inSender, inEvent){
var idx = inEvent.originator.owner.rowIndex;
new Book(this.books[idx]).renderInto(document.body);
},
rendered: function() {
this.inherited(arguments);
var url = '/book';
new enyo.Ajax({url: url,cacheBust: false}).response(this, this.setBooks).go();
},
setBooks: function (inSender, books){
this.books = books;
this.$.repeater.rows = books.length;
this.$.repeater.build();
this.$.repeater.render();
},
});
I did a small app above. But the scroller never display and can not scroll the list.
Is there any idea?
benluo
0 • •
Comments
You should also be able to force the issue by setting the
touchproperty to true:- Spam
- Abuse
0 • Off Topic Insightful •strategyKindinstead:- Spam
- Abuse
0 • Off Topic Insightful •Remember that most things are sized based on what's inside them, but certain things (like Scrollers) are designed to have a fixed height regardless of what's inside them.
You should be able to detect this problem very easily using a DOM inspector (all the main browsers have one).
You can test it by adding
style="height: 300px;"to your Scroller definition, but ultimately I suspect you want to use Fittable (https://github.com/enyojs/layout).- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •Any idea how to deal with it?
- Spam
- Abuse
0 • Off Topic Insightful •display: inline-blockand therefore does not itself have a full width.Instead of try this
{kind: "onyx.Toolbar", layoutKind: "FittableColumnsLayout", components: [Note that since FittableColumns doesn't support top/bottom margins, there may be some weirdness in the toolbar layout. I'm really not sure what to expect there.
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •