1、如果要显示时间控件,需使用<inputbox/> 且type为datepicker,defaultvalue设置默认值,其中dateformat对控件输入进行格式化。

格式化后:

也可以为完整的日期格式
yyyy-MM-dd或其它写法
如下图:

关于获取默认时间

即默认为当前时间,时间格式可以与控件格式一样
对于两个时间输入验证控制如下图:

demo代码附上:
<?xml version="1.0" encoding="UTF-8"?>
<applications xmlns="http://www.wabacus.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wabacus.com ../xsd/wabacus.applications.xsd">
<page id="systemLog" js="webresources/script/validate.js">
<interceptor>
<imports>
<import>java.text.SimpleDateFormat</import>
<import>java.util.Date</import>
</imports>
<preaction>
<![CDATA[
//设置默认查询年份
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy");
String thisYear = dateformat.format(new Date());
rrequest.getRequest().setAttribute("thisYear",thisYear);
]]>
</preaction>
</interceptor>
<tabpanel id="tp1" titlestyle="2" margin="10px" titlewidth="160px" >
<vpanel id="vp2">
<report id="report2" title="统计" parenttitle="统计" linkchart="false" chartype="Column3D.swf" type="fusioncharts" width="700px" chartheight="500" chartstyleproperty="showValues='0'">
<display>
<col column="sum3" label="登录管理"></col>
<col column="sum4" label="系统配置"></col>
<col column="sum5" label="其他"></col>
</display>
<subdisplay>
<![CDATA[
<trendlines>
<line startValue='40000' color='00cc00' displayValue='平均值' />
</trendlines>
]]>
</subdisplay>
<sql>
<value>
<![CDATA[
call getfindall(inStatisYear)
]]>
</value>
<condition name="inStatisYear" label="年份" labelposition="left">
<value>
<![CDATA[date_format(updatetime,'%Y')=#data#]]>
</value>
<inputbox type="datepicker" defaultvalue="request{thisYear}" dateformat="yyyy"></inputbox>
</condition>
</sql>
</report>
<html id="html1" top="10px">
<![CDATA[<div id="linkedchart-container" ></div>]]><!-- 用来显示链接图表 -->
</html>
</vpanel>
</tabpanel>
</page>
</applications>

网友评论