How to use CSS transforms for this use case?

10 views
Skip to first unread message

Alan

unread,
Jan 25, 2011, 9:11:34 AM1/25/11
to Lift
Hi,

A contrived version of the use case I have is the following:

I have a template with:

<div class="lift:ASnippet">
<ul>
<li> Item </li>
</ul>
</div>

Then I have a snippet like the below:

def render = {
val aList = List("A","B","C")
"li *" #> aList
}

which correctly fills the "li"s with my Strings. However, I want also
to give each "li" a unique "id=" attribute (let's say from a second
List). I want to do this to later get easy javascript access to, say,
hide a specific "li" upon an event.

Of course, I have many other ways to accomplish this without css
transforms. But css transforms are neat, and since this seems to be a
common use case I was wondering if there was a way.

Thanks in advance,

Alan

David Pollak

unread,
Jan 25, 2011, 9:15:50 AM1/25/11
to lif...@googlegroups.com
On Tue, Jan 25, 2011 at 6:11 AM, Alan <ala...@gmail.com> wrote:
Hi,

A contrived version of the use case I have is the following:

I have a template with:

   <div class="lift:ASnippet">
       <ul>
           <li> Item </li>
       </ul>
   </div>

Then I have a snippet like the below:

 def render = {
   val aList = List("A","B","C")
   "li *" #> aList
 }


def render = {
   val aList = List("A","B","C")
   val idList = List("a1", "b2, "c3")
   "li" #> aList.zip(idList).map{ case (a, id) => "* *" #> a & "* [id]" #> id}
 }

 
which correctly fills the "li"s with my Strings. However, I want also
to give each "li" a unique "id=" attribute (let's say from a second
List). I want to do this to later get easy javascript access to, say,
hide a specific "li" upon an event.

Of course, I have many other ways to accomplish this without css
transforms. But css transforms are neat, and since this seems to be a
common use case I was wondering if there was a way.

Thanks in advance,

Alan

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics
Reply all
Reply to author
Forward
0 new messages