This does exactly what I wanted. Thank you, and AttrBindParam is even
not mentioned in the Lift book. I found this post usefull:
http://www.mail-archive.com/liftweb@googlegroups.com/msg14476.html

On Jan 25, 10:30 pm, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
> If you want to put a url bound to a function in a custom place like the
> javascript handler, one option is something like this.
> def func() { ... }
> val pageurl = ...  // the detail url
> val url =
>   fmapFunc(
>     (a: List[String]) => {func(); true}
>   )(key =>
>     pageurl + "?" + key + "=_"
>   )
>
> To get the url into the html, use an AttrBindParam IIRC (not sure exact
> usage offhand).
> Then in func load the item into a RequestVar, which will be used by the
> detail page.
>
>
>
> On Mon, Jan 25, 2010 at 2:20 PM, Lukasz Kuczera <kuk...@gmail.com> wrote:
> > Could you please point me, I can't find it.
> > Also im using onclick attribute, can i fit link there ?
> > I'm thinking of using some css hacking to get <a> over whole row but
> > can't remember if it is possible.
>
> > On Jan 25, 5:04 pm, Adam Warski <a...@warski.org> wrote:
> > > Hello,
>
> > > >            <table cellpadding="7px" title="User summary">
> > > >                    <th>First Name</th>
> > > >                    <th>Last Name</th>
> > > >                    <th>Hours Summary</th>
> > > >                    <th>Wage</th>
> > > >                    <lift:Users.list>
> > > >                            <tr onmouseover="this.bgColor='#eeffff';"
> > > > onmouseout="this.bgColor='#FFFFFF';"
> > > >                                    onclick="window.location
> > ='URL_TO_USER_DETAILS';">
> > > >                                    <td><u:fname /></td>
> > > >                                    <td><u:lname /></td>
> > > >                                    <td><u:hours /></td>
> > > >                                    <td><u:money /></td>
> > > >                            </tr>
> > > >                    </lift:Users.list>
> > > >            </table>
>
> > > > What I want to achieve is that users clicks on table row and gets
> > > > redirected to details about selected row (user in this case). I would
> > > > like to implement this in View First pattern so i thought about
> > > > replacing 'onclick' attribute inside Users.list method but I don't
> > > > know the easy way to do this. The naive way would be using regular
> > > > expressions, but i've got feeling that i'm reinventing wheel here.
> > > > Please help.
>
> > > There are several ways to do it.
>
> > > I think the easiest one is to bind the "view" link to a SHtml.link,
> > something like:
>
> > > users.flatMap { user =>
> > > bind("...", ..., "view" -> link("view.html", () => SelectedUser(user),
> > Text("View user")) }
>
> > > where view.html is a template where you can view the user, SelectedUser
> > is a RequestVar that holds the selection after you've clicked.
> > > You will also need to add the view.html to your sitemap.
>
> > > If you want a persistent URL for viewing users, you can add a rewrite
> > rule.
>
> > > The use-case you are writing about is quite well described in the lift
> > book (available in pdf for free), so I would also recommend looking there.
>
> > > --
> > > Adam
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.

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

Reply via email to