[英]Jquery Datepicker is stuck on the same year
So I have my function (using ajax): 所以我有我的功能(使用ajax):
function show_statsMonth($element,$id,$annee)
{
$objResponse = new xajaxResponse();
$tpl = new PHPTAL();
$tpl->setTemplate('templates/lightboxes/statsDays.tpl.xhtml');
$data = array();
/*Enregistrement du nombre d'acces par mois dans un tableau*/
$objDatabase = QApplication::$Database[1];
}
After i create my two dates 创建两个日期之后
$dateL = explode('-', date("Y-m-d",mktime(0,0,0,2,1)) );
$dayL = new QDateTime();
$dayL->setDate(intval($dateL[0]), intval($dateL[1]), intval($dateL[2]));
$dateF = explode('-', date("Y-m-d",mktime(0,0,0,1,1)) );
$dayF = new QDateTime();
$dayF->setDate(intval($dateF[0]), intval($dateF[1]), intval($dateF[2]));
if($annee ==NULL){
$annee='2015';
}
else{
$dayL->setDate(intval($annee), intval($dateL[1]), intval($dateL[2]));
$dayF->setDate(intval($annee), intval($dateF[1]), intval($dateF[2]));
}
And at the end i call my template where i have my Jquery Datepicker like this : 最后,我调用我的模板,让我的Jquery Datepicker像这样:
$objResponse->call("activateDatePickerMonth2",$element,$id,'new');
And my datepicker is like this : 我的日期选择器是这样的:
function activateDatePickerMonth2(element,id,action) {
$("#watchby li a").removeClass("active");
$("#as_a_month").addClass("active");
$('.date-picker').datepicker( "destroy" );
$('.date-picker').datepicker( {
changeYear: true,
showButtonPanel: false,
dateFormat: 'yy-mm',
onChangeMonthYear: function(year, month, inst) {
dpY=year;
dpM=month;
xajax_show_statsMonth(element,id,dpY);
}
});$
I don't know why but my datepicker is stuck on the same year, I can't change the year I select, it's stuck on '2015' 我不知道为什么,但我的日期选择器卡在同一年,我无法更改选择的年份,它卡在“ 2015”年
My question is why, and how i can create a new template with the year i give on the datepicker, to display the new stats. 我的问题是为什么,以及如何使用日期选择器中给出的年份创建新模板,以显示新的统计信息。
My guess is that this piece of code is causing the problem: 我的猜测是这段代码导致了这个问题:
// I do not see $annee being used before this, so it might be always NULL here
if($annee == NULL){
$annee='2015';
// I also do not see $annee being used again after this. If we set it to '2015' where is it used again?
}else{
$dayL->setDate(intval($annee), intval($dateL[1]), intval($dateL[2]));
$dayF->setDate(intval($annee), intval($dateF[1]), intval($dateF[2]));
// Why are you setting the dates again here, if you just set them above?
}
Could you please clarify this code? 您能说明一下这段代码吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.