Really neat, Viktor !

On May 11, 5:07 pm, Viktor Klang <[email protected]> wrote:
> This is the jQuery approach: (written from head, so may not compile)
>
> CSS= .striped tr { background-color : #FFFFFF }
> MARKUP= <table><tbody
> class="striped"><tr><td>hoho</td></tr><tr><td>haha</td></tr><tr><td>hihi</td></tr></tbody></table>
> JS= $('.striped tr:nth-child(odd)').css('background-color','#DDDDDD');
>
> Ref:http://dev.opera.com/articles/view/zebra-striping-tables-with-css3/
>
> Cheers,
> Viktor
>
>
>
> On Mon, May 11, 2009 at 3:54 PM, marius d. <[email protected]> wrote:
>
> > Assume that in your snippet you have a List[String] that you want to
> > render as table rows such as:
>
> > val list = "one" :: "two" :: "three" :: Nil
>
> > def render(xhtml: NodeSeq): NodeSeq = {
> >  <table>{
> >  list.zipWithIndex((e, idx) => <tr><td>{e}</td></tr> %
> >     if (idx % 2 == 0)
> >         Null // Null is a MetaData here
> >     else
> >         ("class" -> "my_gray_out")
> >  )
> >  }</table>
> > }
>
> > note that i did not test the code ... so it may not compile ... but I
> > hope you got the idea.
>
> > Br's,
> > marius
>
> > On May 11, 3:52 pm, Magnus Alvestad <[email protected]> wrote:
> > > I'm still learning lift (and scala). For my sample application I want
> > > to display a table with alternating row colors. I want to put the
> > > style in my CSS file and add a classname to every TR in my table to
> > > indicate odd and even rows. However, I don't know how to take a value
> > > from the snippet binding and assigning it to an attribute in my
> > > template file. Can anyone point me in the right direction?
>
> > > -Magnus
>
> --
> Viktor Klang
> Senior Systems Analyst
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to