Re: How to have every second value in the t:loop different

2012-07-05 Thread Geoff Callender
Sure would. Very cool. On 05/07/2012, at 9:08 PM, Bob Harner wrote: > Yeah, the cycle binding prefix would be a cool thing to add to the core. > On Jul 5, 2012 3:34 AM, "Lance Java" wrote: > >> This wiki page explains creating a custom binding prefix to achieve zebra >> stripes >> http://wiki.a

Re: How to have every second value in the t:loop different

2012-07-05 Thread Lance Java
I'm not sure that this implementation of CycleBinding is fit for core as it uses a thread local so nested bindings won't work (I don't think) I don't think that the following would work. ... ... I'm thinking that ComponentResources.storeRenderVariable() and compone

Re: How to have every second value in the t:loop different

2012-07-05 Thread Bob Harner
Yeah, the cycle binding prefix would be a cool thing to add to the core. On Jul 5, 2012 3:34 AM, "Lance Java" wrote: > This wiki page explains creating a custom binding prefix to achieve zebra > stripes > http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle > > eg: > > ... >

Re: How to have every second value in the t:loop different

2012-07-05 Thread Lance Java
This wiki page explains creating a custom binding prefix to achieve zebra stripes http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle eg: ... -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-have-every-second-value-in-the-t-loop-different-tp5714

Re: How to have every second value in the t:loop different

2012-07-05 Thread Kristian Marinkovic
hi geoff, Even Odd is extremely elegant; never thought of such a solution g, kris On Thu, Jul 5, 2012 at 7:32 AM, Geoff Callender wrote: > ...which is why injecting EvenOdd is such a good solution. It just works, > everywhere. > > > http://jumpstart.doublenegative.com.au/jumpstart/examples/tabl

Re: How to have every second value in the t:loop different

2012-07-04 Thread Geoff Callender
...which is why injecting EvenOdd is such a good solution. It just works, everywhere. http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/alternatingloop Cheers, Geoff On 5 July 2012 10:49, Bob Harner wrote: > Remember that ":nth-child()" selector doesn't work in IE 8 and > ear

Re: How to have every second value in the t:loop different

2012-07-04 Thread Bob Harner
Remember that ":nth-child()" selector doesn't work in IE 8 and earlier, if that matters. On Wed, Jul 4, 2012 at 5:47 PM, bhorvat wrote: > Yea I totally agree with that. I have implemented using the css which worked > for me. > cheers all > > -- > View this message in context: > http://tapestry.1

Re: How to have every second value in the t:loop different

2012-07-04 Thread bhorvat
Yea I totally agree with that. I have implemented using the css which worked for me. cheers all -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-have-every-second-value-in-the-t-loop-different-tp5714278p5714289.html Sent from the Tapestry - User mailing list archive

Re: How to have every second value in the t:loop different

2012-07-04 Thread Thiago H de Paula Figueiredo
On Wed, 04 Jul 2012 17:22:32 -0300, bhorvat wrote: My problem is that I have a lot of code duplication, also this seems to me as a simple display problem so I dont like the fact that I have to create logic in the java page for this just so that I can put one extra css class in one place.

Re: How to have every second value in the t:loop different

2012-07-04 Thread bhorvat
So this worked for me .itRow { display: table-row; } #rowId:nth-child(even) { background-color:#8d8b8c; } If you have a neater way to do this, due tell me. But like I said thank you all for great suggestions :D -- View this message in context: http://tapestry.1045711.n5.nabble.com/

Re: How to have every second value in the t:loop different

2012-07-04 Thread bhorvat
The css selector is what I need. But I am not sure how to use it, I have tired .itRow { display: table-row; } .itRow:nth-child(even) { background-color:#8d8b8c; } but it is not working, will continue to try it till I figure it out, but if you have an idea please let me know. Still tnx fo

Re: How to have every second value in the t:loop different

2012-07-04 Thread Kristian Marinkovic
if it is only visual, and just about setting an css class: -> use the css selector mentioned by dusko; no duplication On Wed, Jul 4, 2012 at 10:22 PM, bhorvat wrote: > My problem is that I have a lot of code duplication, also this seems to me as > a simple display problem so I dont like the fact

Re: How to have every second value in the t:loop different

2012-07-04 Thread bhorvat
My problem is that I have a lot of code duplication, also this seems to me as a simple display problem so I dont like the fact that I have to create logic in the java page for this just so that I can put one extra css class in one place. Apart from that the 2 blocks in your case would be exactly

Re: How to have every second value in the t:loop different

2012-07-04 Thread Dusko Jovanovski
Hello there If the change you want to apply to those elements is purely visual, I would suggest the :nth-child(even) pseudo selector [1]. On the other hand, if you still want to apply that particular class to the div, I would suggest this approach: You return the wanted class

Re: How to have every second value in the t:loop different

2012-07-04 Thread Neil Pierson
how about Java: public String getRowClass() { return (index % 2 == 0) ? "evenRow" : "oddRow"; } tml: ... css: .oddRow { background: etc... } .evenRow { background: etc } On Jul 4, 2012, at 4:04 PM, bhorvat wrote: > So

Re: How to have every second value in the t:loop different

2012-07-04 Thread Kristian Marinkovic
it would be easier to give you an advice if you'd outline the problem you are having a little more. but if you ask me i'd put a delegate inside the loop and let the "to" binding decide what component/block to render. i use this approach to render a list of "item" (types) that may have completely d

How to have every second value in the t:loop different

2012-07-04 Thread bhorvat
So here is the annoying problem, I have a loop and I need to make every even rows different then odd rows. So the way I do this is I have a index and a methods isEvenRow that returns if the row is even. Then based on that I have one if withe else section. The only difference between content of both