【发布时间】:2022-08-02 18:38:43
【问题描述】:
目前我正在尝试在我的模式中添加 JTSage 日期框。
如果我使用正常方式(显示输入文本并单击输入字段),它将显示日期框。
但我正在尝试使用No Input BoxNo Input Display。
在检查页面时。我只需要在下面实现代码,日期框就会自动显示。
但就我而言,日期框根本没有显示。
<div class=\"form-group\">
<div class=\"input-group\" style=\"display:none\">
<input id=\"calDate\" type=\"text\" class=\"form-control\" data-role=\"datebox\" data-options=\'{\"mode\":\"flipbox\",\"useInline\":\"true\",\"hideInput:\"true\"}\' readonly=\"readonly\">
</div>
</div>
有什么我想念的吗?
编辑:
<input id=\"calDate\" type=\"text\" class=\"form-control\" data-role=\"datebox\" readonly=\"readonly\">
$(\'#calDate\').datebox({
mode: \"flipbox\",
useLang:\"id\",
overrideSetDateButtonLabel:\"Atur tanggal\",
useInline:\"true\",
useInlineAlign:\"center\",
hideInput:\"true\",
beforeOpenCallback:\"abc\",
beforeOpenCallbackArgs:\"def\",
openCallBack:\"ghi\",
openCallBackArgs:\"jkl\",
closeCallBack:\"mno\",
closeCallBackArgs:\"pqr\",
});
它通过使用上面的代码修复
但是还有另一个错误,如下图所示,它没有直接显示当前日期。我需要对日期框做一个小手势,以便它移动到当前日期。但为什么我要触摸它才能让它工作呢?
更新 :
我在模态体内运行日期框。当我在没有模态的情况下使用它时,它运行正常。有人可以帮助找到解决方案吗?
<body>
<button type=\"button\" id=\"call\"class=\"btn btn-primary\">ABC</button>
</body>
<div class=\"modal fade\" id=\"myModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">
<div class=\"modal-dialog\" role=\"document\">
<div class=\"modal-content\">
<div class=\"modal-header\">
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>
<h4 class=\"modal-title\" id=\"myModalLabel\"> Detail</h4>
</div>
<div class=\"modal-body\" id=\"modal-content\">
<div class=\"form-group\">
<div class=\"input-group\" >
<input id=\"calDate\" type=\"text\" class=\"form-control\" data-role=\"datebox\" readonly=\"readonly\">
</div>
</div>
</div>
<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>
</div>
</div>
</div>
</div>
<script>
$(\"#call\").click(function(e){
$(\"#myModal\").modal(\"show\");
});
$(\'#calDate\').datebox({
mode: \"flipbox\",
useLang:\"id\",
overrideSetDateButtonLabel:\"Atur tanggal\",
useInline:\"true\",
useImmediate:\"true\",
useInlineAlign:\"center\",
hideInput:\"true\",
beforeOpenCallback:\"abc\",
beforeOpenCallbackArgs:\"def\",
openCallBack:\"ghi\",
openCallBackArgs:\"jkl\",
closeCallBack:\"mno\",
closeCallBackArgs:\"pqr\",
});
</script>
第二个问题
我正在使用 modes : flipbox 。 flipbox 点击set date 时如何获取值,如下图所示?
-
自从我一直在积极开发它已经很长时间了 - 但是,“useImmediate”会给你你正在寻找的行为吗?我认为该选项旨在帮助在控件“准备好”时强制更新,并摆脱您需要触摸它以显示日期
-
@J.T.Sage 尝试使用 Immediate 并且它不起作用。如果我不在模态框内使用它,它会直接运行,但如果它在模态框内,则需要触摸日期框