Quick and dirty impl could look like this:
import _root_.scala.xml.{NodeSeq, Text}
import _root_.net.liftweb.mapper._
import _root_.net.liftweb.util._
import _root_.net.liftweb.http._
import S._
import _root_.java.text.{DateFormat,SimpleDateFormat}
class MappedDatePicker[T<:Mapper[T]](fieldOwner: T) extends
MappedDate(fieldOwner) {
override def defaultValue = new java.util.Date
override def _toForm: Box[NodeSeq] = S.fmapFunc({s: List[String] =>
this.setFromAny(s)}){funcName =>
val id = "entrydate" + MappedDatePicker.getNext.toString
val script = "$(function() {$('#" + id +
"').datepicker({dateFormat:'yy/mm/dd'});});"
Full(
<input type='text' id={id} name={funcName} value={toString}
maxlength="10" size="10"/>
<script type="text/javascript">{script}</script>
)
}
override def toString = MappedDatePicker.toStringFormat.format(is)
override def asHtml = Text(MappedDatePicker.asHtmlFormat.format(is))
}
object MappedDatePicker {
def toStringFormat = new java.text.SimpleDateFormat("yyyy/MM/dd")
def asHtmlFormat = DateFormat.getDateInstance(DateFormat.SHORT)
private var count = 0
def getNext = {count += 1; count}
}
Tweek wrote:
> Hi.
> I'm totally beginer in Lift and i've never used JQuery. Can Anybody
> tell me how to add DatePicker to my DateTime field in my website step
> by step?
> thanks and regards.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---