MappedNullableLong doesn't display/edit correctly
A MappedNullableLong field is not displayed correctly. Instead of showing just the number (if Full) or a blank (if Empty), it shows the toString of the Box (i.e., "Empty" or "Full(x)" where x is the contained value). Also, creating a trait with a toForm method and adding it to a MappedNullableLong field doesn't work. See https://groups.google.com/d/topic/liftweb/K0v_JkZjYMI/discussion.
Example code:
Example code:
trait NiceNullableLong[T <: Mapper[T]] {
self: MappedNullableLong[T] =>
override def toString = is.openOr("").toString
override def toForm = Full(SHtml.text(toString,
x => if (x.length == 0) set(Empty) else set(Full(Integer.parseInt(x)))))
}
object maxMinutes extends MappedNullableLong(this) with NiceNullableLong[User]
Leave a comment
(In revision:d2d60dfe29712d9155e6c4e00fb0179426a7fe19) Closes #938. Closes #1095. Better support to asJsExp in foreign key references. Better handling of Nullable fields in forms and display
Branch: master
Branch: master