Datepicker Plugin-Nutzung in Phonegap für Android
Ich versuche, meine erste mobile app in phonegap. Ich bin versucht, datepicker plugin für Android. Mein html-Code ist unten. Ich sehe nur zwei Kastraten "Phonegap arbeitet" und die Warnung #1. Ist es nicht zeigen, jede Warnung in den focus event und natürlich, es scheint nicht zu funktionieren. Bin ich etwas fehlt?
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script>
document.addEventListener("deviceready",onDeviceReady, false);
function onDeviceReady(){
navigator.notification.alert("PhoneGap is working!!");
}
alert('1 '+new Date());
$('.nativedatepicker').focus(function(event) {
var currentField = $(this);
alert('2 '+new Date());
alert('3 '+currentField.val());
var myNewDate = Date.parse(currentField.val()) || new Date();
alert('4 '+new Date());
//Same handling for iPhone and Android
window.plugins.datePicker.show({
date : myNewDate,
mode : 'date', //date or time or blank for both
allowOldDates : true
}, function(returnDate) {
var newDate = new Date(returnDate);
currentField.val(newDate.toString("dd/MMM/yyyy"));
//This fixes the problem you mention at the bottom of this script with it not working a second/third time around, because it is in focus.
currentField.blur();
});
});
</script>
</head>
<body>
<input id="meeting" type="text" value="09/Feb/2013" class="nativedatepicker"/>
</body>
</html>
Du musst angemeldet sein, um einen Kommentar abzugeben.
benutzen Sie diesen link, dieser kann hilft, die Sie für das plugin
https://github.com/phonegap/phonegap-plugins/tree/master/Android/DatePicker
und haben auch in diesem link
http://code.google.com/p/mobiscroll/