Popup Calendar (WebPlayer compatible)



Ingredients
  • Spotfire 6.0+
  • TextArea
  • Input Field Property Control
  • Javascript script





Preparation
  1. Add a TextArea and right click to edit the HTML
  2. Add an Input Field Property Control wrapped by a tag with id='dt1' 
  3. Add a span html tag with id='dt1picker' next to your SpotfireControl for the calendar 
  4. Add javascript

HTML:
<span id='dt1'>
   <SpotfireControl id="ed353..YourSInputPropControl" />
</span>
<span id='dt1picker'></span>

JS:
//update document property after selection
function datePicker_onSelect(selectedDate){
 //alert(selectedDate)
 $("#dt1 input").focus()
$("#dt1 input").blur()
}

//jquery datepicker configuration
//you can comment the buttonImageOnly and buttonImage lines to show a button instead of a calendar or the image of your choice.
pickerOptions = {
 showOn: 'button', 
 buttonImageOnly: true, 
 buttonImage: 'http://staff.washington.edu/tabrooks/343INFO/UnobtrusiveDatePicker/cal-grey.gif', 
 minDate: "-36M", maxDate: "+0D",
 changeMonth: true,
 changeYear: true,
 altField:"#dt1 input",
 onSelect:datePicker_onSelect
 }

//create the date picker
document.getElementById('dt1picker').innerHTML="<input type='hidden' id='datePicker'>"
$("#datePicker").datepicker(pickerOptions);



Refer to the jquery datepicker documentation for configuration options
Previous
Next Post »