繁体   English   中英

如何在具有月和年增量选项的检票口中使用DatePicker?

[英]How to use DatePicker in wicket which have month and year increment option?

我在Java wicket中使用DatePicker,

DateTextField txtInvoiceDate=new DateTextField("txtInvoiceDate",new PropertyModel<Date>(objmodel, "txtInvoiceDate"),new PatternDateConverter("dd/MM/yyyy", true));
        txtInvoiceDate.add(new DatePicker());
        add(txtInvoiceDate);  

它仅显示月份增加选项,但我也希望年份增加选项。
因此,请给我任何建议或指导。

我尚未发现用于增加年份的内置功能,但是有一种非常简单的方法可以更轻松地设置年份。 只需覆盖enableMonthYearSelection。

DateTextField txtInvoiceDate=new DateTextField("txtInvoiceDate",new PropertyModel<Date>(objmodel, "txtInvoiceDate"),new PatternDateConverter("dd/MM/yyyy", true));
DatePicker picker = new DatePicker(){
    @Override
    protected boolean enableMonthYearSelection() {
        return true;
    }
};
txtInvoiceDate.add(new DatePicker());
add(txtInvoiceDate);  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM