简体   繁体   English

DateBox Jquery移动扩展

[英]DateBox Jquery mobile extension

I was trying to make a extension of datebox were I first needed to select the date and then click "Choose date". 我试图对日期框进行扩展,如果我首先需要选择日期,然后单击“选择日期”。

All works, well almost. 一切顺利,差不多。 When I click the "Choose date" button the content behind the modal window get clicked, and in my case it is a search button. 当我单击“选择日期”按钮时,将单击模式窗口后面的内容,在我的情况下,这是一个搜索按钮。

Anyone know why? 有人知道为什么吗?

 if (o.useSelectDateButton) {
            $('<a href="#">Välj datum</a>')
                .appendTo(hRow).buttonMarkup({ theme: o.theme, icon: 'check', modal: true, iconpos: 'left', corners: true, shadow: true })
                .on(o.clickEvent, function(e) {
                    if ($(this).jqmData('enabled')) {
                        w.theDate.set(2, 1).set(1, $(this).jqmData('month')).set(2, $(this).jqmData('date'));
                        w.d.input.trigger('datebox', { 'method': 'set', 'value': w._formatter(w.__fmt(), w.theDate), 'date': w.theDate });
                    }

                    if (w.theDate == new Date()) {
                        w.theDate.set(2, 1).set(1, $(this).jqmData('month')).set(2, $(this).jqmData('date'));
                        w.d.input.trigger('datebox', { 'method': 'set', 'value': w._formatter(w.__fmt(), w.theDate), 'date': w.theDate });
                    }
                    w.d.input.trigger('datebox', { 'method': 'close' });
                });
        }

I call the datebox like this: 我这样称呼日期框:

 <input name="datepicker" id="datepicker" type="date" data-role="datebox" data-options='{"mode": "calbox", "calShowWeek": true, "overrideCalStartDay": 1, "useModal": true, "useAltIcon": true, "afterToday": true, "useFocus": true }'>

Added a JsFiddle Click for fiddle 添加了JsFiddle Click for fiddle

The problem is that i cant recreate the problem in the browser, it only happens in a mobile device. 问题是我无法在浏览器中重新创建问题,它仅在移动设备中发生。

can you make fiddle with this?which jquery libraries you use for this? 你能用这个做些小提琴吗?

An another option / alternative: 另一个选项/替代:

Take at look at this 看看这个

its a very simple datetimepicker which jquery libraries and it is very simple to put this to work. 它是一个非常简单的datetimepicker jQuery库,并且很容易使用。

head tag: 头标签:

 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});

body tag: 身体标签:

<p>Date: <input type="text" id="datepicker" /></p>

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

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