Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
HTML
HTML
<sx:div href="%{#url}">
  Initial Content
</sx:div>

...

Reloads content when topic is published
Code Block
HTML
HTML

<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" style="display:none"/>
<sx:div href="%{#url}" updateFreqlistenTopics="2000/refresh">
  Initial Content
</sx:div>

...


<s:submit value="Refresh" onclick="dojo.event.topic.publish('/refresh')" />
Updates its content every 2 seconds, shows indicator while loading content
Code Block
HTML
HTML
<sx:div<img hrefid="%{#url}indicator" delay="2000">src="${pageContext.request.contextPath}/images/indicator.gif" style="display:none"/>
<sx:div href="%{#url}" updateFreq="2000">
  Initial Content
</sx:div>

...

Loads its content after a delay of 2 seconds
Code Block
HTML
HTML
<sx:div href="%{#url}" loadingTextdelay="reloading2000">
  Initial Content
</sx:div>
Show some text while content is loaded
Code Block
HTML
HTML

<sx:div href="%{#url}" loadingText="reloading" showLoadingText="true">
  Initial Content
</sx:div>

...

Code Block
HTML
HTML
<sx:div href="%{#url}"
        listenTopics="/refresh"
	startTimerListenTopics="/startTimer"
	stopTimerListenTopics="/stopTimer"
	updateFreq="3000">
  Initial Content
</sx:div>

<s:submit value="Refresh" onclick="dojo.event.topic.publish('/refresh')" />
<s:submit value="Start refresh timer" onclick="dojo.event.topic.publish('/startTimer')" />
<s:submit value="Stop refresh timer" onclick="dojo.event.topic.publish('/stopTimer')" />

Date and Time picker

Date picker
Code Block
HTML
HTML

<sx:datetimepicker name="picker" />
Time picker
Code Block
HTML
HTML

<sx:datetimepicker type="time" name="picker" />
Set value from an String
Code Block
HTML
HTML

<sx:datetimepicker value="%{'2007-01-01'}" name="picker" />
Set value from stack (value must evaluate to either a Date, Calendar, or an String that can be parsed using the formats defined in SimpleDateFormat, and RFC 3339)
Code Block
HTML
HTML

<sx:datetimepicker value="date" name="picker" />
Set/Get value using JavaScript
Code Block
HTML
HTML

<script type="text/javascript">
  function setValue() {
     var picker = dojo.widget.byId("picker");
     
     //string value
     picker.setValue('2007-01-01');
     
     //Date value
     picker.setValue(new Date());
  }
  
  function showValue() {
     var picker = dojo.widget.byId("picker");
     
     //string value
     var stringValue = picker.getValue();
     alert(stringValue);
      
     //date value
     var dateValue = picker.getDate();
     alert(dateValue);
  }
</script>

<sx:datetimepicker id="picker" />
Style the textbox
Code Block
HTML
HTML

<sx:datetimepicker id="picker" cssStye="background:red" cssClass="someclass"/>