Domino 9/Dojo 1.8 - 没有默认值的日期时间选择器 [英] Domino 9 / Dojo 1.8 - Date Time Picker without default value

查看:19
本文介绍了Domino 9/Dojo 1.8 - 没有默认值的日期时间选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个没有默认值的日期时间选择器控件.似乎不再可能了:-(

I want a Date Time Picker control WITHOUT a default value. Doesn't seem to be possible anymore :-(

要重现,请创建一个空白 XPage 并放置一个 Date Time Picker 控件.在浏览器中打开 XPage,您将看到它默认为今天.

To reproduce, create a blank XPage and place a Date Time Picker control. Open the XPage in the browser and you will see that it defaults to today.

我没有找到将默认值设置为空值的任何方法.我尝试将所有属性/数据/默认值设置为 0、null、空字符串等 - 没有运气.

I didn't found any way to set the default to an empty value. I tried setting all properties/data/default to 0, null, empty string and so on - no luck.

我尝试了 data-dojo-probs 属性的值:'',这将默认值设置为 1970-1-1,但不是空白.

I tried the data-dojo-probs attribute with value:'', this sets the default to 1970-1-1, but not to blank.

有什么想法吗?

推荐答案

这是 ND9 中的一个已知问题,报告为 SPR DEGN966F5V.

This is a known issue in ND9, reported as SPR DEGN966F5V.

该问题的解决方法(来自 SPR)是修改 postCreate 函数中的小部件原型,以防止该值被重置.

A work around for the issue (from SPR) is to modify the widget prototype in the postCreate function to prevent the value from being reset.

require([ 
        "dojo/_base/lang", 
        "ibm/xsp/widget/layout/DateTextBox", 
        "ibm/xsp/widget/layout/TimeTextBox", 
        "ibm/xsp/widget/layout/DateTimeTextBox" 
], function(lang, DateTextBox, TimeTextBox, DateTimeTextBox){ 
        var a = {}; 
        lang.mixin(a, { 
                postCreate: function(){ 
                        this.inherited(arguments); 
                } 
        }); 
        DateTextBox.extend(a); 
        TimeTextBox.extend(a); 
        DateTimeTextBox.extend(a); 
}); 

这是它工作的一个例子.

Here is an example of it working.

<?xml version="1.0" encoding="UTF-8"?> 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"> 
        <xp:this.resources> 
                <xp:script clientSide="true"> 
                        <xp:this.contents><![CDATA[ 
require([ 
        "dojo/_base/lang", 
        "ibm/xsp/widget/layout/DateTextBox" 
], function(lang, DateTextBox){ 
        var a = {}; 
        lang.mixin(a, { 
                startup: function(){ 
                        this.inherited(arguments); 
                        this.set("value", null); 
                } 
        }); 
        DateTextBox.extend(a); 
}); 
]]></xp:this.contents> 
                </xp:script> 
        </xp:this.resources> 

        <xp:inputText id="inputText1" value="#{sessionScope.inputText1}"> 
                <xp:this.converter> 
                        <xp:convertDateTime type="date" /> 
                </xp:this.converter> 
                <xp:dateTimeHelper /> 
        </xp:inputText> 
</xp:view> 

这篇关于Domino 9/Dojo 1.8 - 没有默认值的日期时间选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆