Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Joe on Jul 16, 2009 12:42
open dhtmlx forum
Buttons on Calendar Header

Hi,

Is there anyway to attach events to the buttons on the calendar's header?

Thanks,

Joe
Answer posted by Alex (support) on Jul 17, 2009 01:57

hello,

it is possible only by code modification. lines 624-674 of the dhtmlxcalender.js define header buttons. 

You can add event call to the each button here (highlighted lines should be added):

...
  btnClose.onclick = function (e) {
  (e||event).cancelBubble=true;
  self.callEvent("onButtonClick",["close"])
  self.hide();
   
 }
...
 btnMin.onclick = function(e) {
  (e||event).cancelBubble=true;
  self.callEvent("onButtonClick",["minimize"])
  self.minimize();
 }
...
  btnClear.onclick = function(e) {
  (e||event).cancelBubble=true;
  self.con.value = "";
  self.callEvent("onButtonClick",["clear"])  
  self.hide(); 
  }


To attach button event on the page you can use the following aproach:

calendar.attachEvent("onButtonClick",function(type){

if(type=="click") ...

})