DHTMLX日历没有关闭

时间:2013-08-09 21:24:44

标签: dhtmlx

我正在将dhtmlxcalendar初始化为文本框。点击日历后,如果我没有选择日期,并点击其他标签,日历就不会关闭

var myCalendar = new dhtmlXCalendarObject(["effStartDate"]);
     myCalendar.setDateFormat("%d-%M-%Y");
     myCalendar.setSensitiveRange(new Date(),null);
     document.getElementById("effStartDate").value=  currentDate();

我有一个dhtmlx网格,其中一个cloumn是日历,如果我没有选择它没有关闭的日期也有同样的问题

var responsibilityTaskGrid;
    responsibilityTaskGrid = new dhtmlXGridObject('responsibilityTaskGridBox');
    responsibilityTaskGrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/");
    responsibilityTaskGrid.setHeader("Responsibility Name,Task UI Name,Effective Start Date,Effective End Date,Status,Edit/Delete,ID");
    responsibilityTaskGrid.setInitWidths("150,*,120,120,80,80,0");
    responsibilityTaskGrid.setColAlign("left,left,center,center,center,center");
    responsibilityTaskGrid.setColTypes("ro,ro,ro,dhxCalendarA,ro,ro,ro");

1 个答案:

答案 0 :(得分:0)

在DHTMLX中,他们没有提供该选项。

使用“ESC”键或自定义日历对象,如下面提到的代码

路径: - dhtmlx / dhtmlxCalendar / codebase / dhtmlxcalendar.js

//Declare public variable here


var calObject;

function dhtmlXCalendarObject(inps, skin) {

......

// create base
this.base = document.createElement("DIV");
// After this Code

....



//Code add for place the image in dhtmlx Calendar
    this.base.innerHTML = "<div class='dhtmlxcalendar_month_cont'><ul class='dhtmlxcalendar_line'>" +       
            "<li class='dhtmlxcalendar_cell dhtmlxcalendar_month_hdr'>" +
            "   <div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right'>" +
            "       <img id='myImg' src='images/icon-close.gif' height='15px' width='15px' onclick='javascript:calClose(this)'/>" +
            "   </div>" +
            "</li>" +           
            "</ul></div>";
//end here

.....



// set init date
this.setDate(this._activeDate);
//After this Code 

.....

**//Code add for assigning object


calObject = this;


}

//Code add for close the calendar
function calClose(elem){    
    calObject.hide();
}

//结束这里