Open igorkrumpak opened 9 years ago
Hey @igorkrumpak. The forums might be a better place to get help, although I do agree we're lacking in examples which is possibility better tracker on GitHub. Did you see all the Fview Lab examples? The "period table" and "custom layout" pads give examples of using famousEach.
For your particular issue, where are you including the "Content" template? Is it directly below a +Scene, +Node or some wrapped Layout?
Yes i saw exemples. You can only use famousEach inside custom layout? My current code is this.
body
+Scene
+Node size=reactiveNavigationSize position=reactiveNavigationPosition
+DOMElement
+Navigation
+Node size='A:100;P:100' position=reactiveMenuPosition
+DOMElement class="blue-bg"
+Menu
+Node size=reactiveContentSize position=reactiveContentPosition
+DOMElement
+Content
template(name='Content')
+famousEach articles
+Node size='A:50;A:50'
+DOMElement
| Item: #{title}
You don't have to use a custom layout, but without a layout, everything will render on top of each other. To be honest, the new version of famous came quite bare.... if you're familiar with the old version, I'm going to write our own SequentialLayout and other views for famous-views, until famous provide something better.
Back to your code, the issue is you're trying to add Node
's to a DOMElement
... this isn't possible, but I agree we should have a better error here. If you drop the DOMelement
that's 2nd from the bottom in your body
, it will work (the Node
's in Content
will be added to the bottom Node in body
.
In case you're purposefully trying to enclose all the Content DOMElement's in a parent DOMElement, the way to do this (in famous) is to still add the child nodes do the Node that has the DOMElement, not to the DOMElement itself. But you shouldn't do that unless you have a good reason to.
Did that all make sense? :)
Yes it did!!!!
Ok, I added famouseEach directly to node and it's working now. The only problem I have now is that items are overlapping.
Great stuff :) Yeah, what you're experiencing is what I described... nodes by default will overlap. The old version of Famous came with a few basic layouts built in, but not the new version. The simple "each node next to each other" layout was called SequentialLayout, and I'm just going to write this myself and put it in the next version of famous-views.
Ok tnx. Will wait then on next version!
Can you please help me with famousEach in my project. Currently I have this.
I get error
"Uncaught TypeError: Cannot read property 'addedAt' of undefined"
Can you can help me?