DatePicker Application
This application isn't bundled with any XWiki product by default.
Application developed by the XWiki Development Team.
This application can be downloaded .
Application developed by the XWiki Development Team.
This application can be downloaded .
DatePicker Application
Date Picker
How to use
Including the proper resources
- For XWiki Enterprise versions < 1.8
$xwiki.jsx.use("XWiki.DatePickerExtension") $xwiki.ssx.use("XWiki.DatePickerExtension")
- Starting with XWiki Enterprise 1.8
$xwiki.jsfx.use("js/scriptaculous/scriptaculous.js") $xwiki.jsx.use("XWiki.DatePickerExtension") $xwiki.ssx.use("XWiki.DatePickerExtension")
Adding a date picker to an input field
<input type="text" name="mydate" id="mydate_id" /> <script type="text/javascript"> var dpicker = new DatePicker({ relative : 'mydate_id', language: "$context.language" }); </script>
A code example
The following example is an extension to the default class sheet velocity code supplied when you create a new class like in the FAQ tutorial. In this case any properties that are date type will have the date picker added to enter the date.## Includes for the date picker for date properties $xwiki.jsfx.use("js/scriptaculous/scriptaculous.js") $xwiki.jsx.use("XWiki.DatePickerExtension") $xwiki.ssx.use("XWiki.DatePickerExtension") #set($class = $doc.getObject("Projects.ProjectClass").xWikiClass) #set($hasProps = false) #foreach($prop in $class.properties) #if($velocityCount == 1) #set($hasProps = true) <dl> #end <dt> ${prop.prettyName} </dt> <dd>$doc.display($prop.getName())</dd> ##Now if we are editing the property and it is ##a date property, attach a date picker to it #if(($context.action == 'inline') and ($prop.type == 'DateClass')) <script type="text/javascript"> var dpicker = new DatePicker({ relative : '${class.name}_${class.number}_${prop.name}', language : "$context.language" }); </script> #end #end #if($hasProps) </dl> #end
Result