Skip to content

Commit

Permalink
修正nodejs demo中minical的bug
Browse files Browse the repository at this point in the history
修正minical当切换视图后点击事件无效的bug
  • Loading branch information
xuanye committed Jul 26, 2013
1 parent ba6fbbd commit 5468d90
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions example/nodejs/static/js/plugin/minicalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ define(function(require, exports, module) { //参数名字不能改
// body...
var me = this;
var aprev = this.__parent.find("a.cal-prev");
var anext = this.__parent.find("a.cal-next");
var tb = this.__parent.find("table.minical-body tbody td");
var anext = this.__parent.find("a.cal-next");
aprev.click(function(){
me.__option.currentDate = DateAdd("m",-1,me.__option.currentDate);
me.filldate();
Expand All @@ -40,24 +39,8 @@ define(function(require, exports, module) { //参数名字不能改
{
me.__option.onchange.call(me,me.__option.currentDate);
}
});
tb.each(function(i){
$(this).click(tbclick);
});
function tbclick(){
me.__parent.find("td.minical-current").each(function(){
$(this).removeClass("minical-current");
});
$(this).addClass("minical-current").blur();
var idate = $(this).attr("xdate");
var date = idate.split(/\D/);
me.__option.currentDate= new Date(date[0],parseInt(date[1],10)-1,date[2]);
if(me.__option.onchange)
{
me.__option.onchange.call(me,me.__option.currentDate);
}

}
});

},
render:function (argument) {
var html=[];
Expand All @@ -78,6 +61,7 @@ define(function(require, exports, module) { //参数名字不能改
this.__parent.html(html.join(""));
},
filldate:function () {
var me = this;
var tb = this.__parent.find("table.minical-body tbody");
var year = this.__option.currentDate.getFullYear();
var monthName = this.__option.monthName[this.__option.currentDate.getMonth()];
Expand Down Expand Up @@ -120,7 +104,23 @@ define(function(require, exports, module) { //参数名字不能改
bhm.push("</tr>");
}
}
tb.html(bhm.join(""));
tb.html(bhm.join(""));
tb.find("td").each(function(i){
$(this).click(tbclick);
});
function tbclick(){
me.__parent.find("td.minical-current").each(function(){
$(this).removeClass("minical-current");
});
$(this).addClass("minical-current").blur();
var idate = $(this).attr("xdate");
var date = idate.split(/\D/);
me.__option.currentDate= new Date(date[0],parseInt(date[1],10)-1,date[2]);
if(me.__option.onchange)
{
me.__option.onchange.call(me,me.__option.currentDate);
}
}
},
goto:function(date) {
// body...
Expand Down
2 changes: 1 addition & 1 deletion example/nodejs/static/js/plugin/xgcalendar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 Xuanye.wan
* Copyright (c) 2013 Xuanye.wan
* Last update: 2013-02-1
* Author:假正经哥哥(xuanye)
* Email:[email protected]
Expand Down

0 comments on commit 5468d90

Please sign in to comment.