Something like this?
object reportsTo extends MappedLongForeignKey(this, User) {
override def displayName = "Reports To"
override def asHtml = {
<span>{User.find(By(User.id, this)).map(u =>
(u.firstName + " " +
u.lastName)).openOr(Text("PM"))}</span>
}
override def validSelectValues: Box[List[(Long, String)]] =
Full(User.findAll(OrderBy(User.lastName, Ascending)).map(c =>
(c.id.is, c.niceName)))
override def _toForm = {
Full(<span>{User.find(By(User.id, this)).map(u =>
(u.firstName + "
" + u.lastName)).openOr(Text("No Reports To"))}</span>)
}
}
On Jul 11, 11:20 am, Josh Suereth <[email protected]> wrote:
> Hey all,
>
> This is my first venture into lift's ORM and I'm upgrading an existing
> codebase, so I'm not sure how all the pieces fit together, but I've figured
> out enough to patch in my features. I was wondering if someone can help me
> out with this issue:
>
> The code is using the "toForm" method on the objects inside a
> KeyedMetaMapper. What I want to see for the foriegn key relationship is a
> combo box with a drop-down of the possible values (perhaps with a
> user-specified toString on those foreign key objects). toForm simply
> displays: "Can't change" on the MappedLongForeignKey. What/where should I
> look to change this?
>
> Thanks!!!
> - Josh
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---