在 gxt 中设置时间作为默认值?

发布于 2024-09-28 06:43:11 字数 220 浏览 2 评论 0原文

我意识到我的所有组合框都有这个。我希望它有一个默认值,所以我尝试了...

TimeField field = new TimeField();
field.setFormat(DateTimeFormat.getFormat("HH:mm"));
field.setRawValue("10:00");

但是当我打开该部分时,该值没有被设置。仍然是一片空白。

I realized I have this with all combo box. I want it to have a default value so I tried...

TimeField field = new TimeField();
field.setFormat(DateTimeFormat.getFormat("HH:mm"));
field.setRawValue("10:00");

But when I open the section, the value does not get set. It is still blank.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

是你 2024-10-05 06:43:11

我找到了解决方案。我使用了以下格式。

private TimeField fromTime = new TimeField();
    fromTime.setFormat(DateTimeFormat.getFormat("HH:mm"));
    fromTime.setIncrement(1);
    Time time = new Time();
    time.setText("00:00");
    fromTime.setValue(time);
    fromTime.setTriggerAction(TriggerAction.ALL);
    toolbar.add(fromTime);

I m found the solution. I used following format its woks.

private TimeField fromTime = new TimeField();
    fromTime.setFormat(DateTimeFormat.getFormat("HH:mm"));
    fromTime.setIncrement(1);
    Time time = new Time();
    time.setText("00:00");
    fromTime.setValue(time);
    fromTime.setTriggerAction(TriggerAction.ALL);
    toolbar.add(fromTime);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文