about Dates as links

Hi, dear

I found something interesting sample: samples/03_extensions/06_links_plugin.html.
In my case, I would rather turn to other webpage in our system when the day label in month view as a link is clicked. please let me have a working code if it’s possible.

Thank you.

Hello,

Try using uncompressed extension ( \scheduler\sources\ext\ext_active_links.js ), you can easily modify it to link to something else:

scheduler.templates.month_day=function(date){ return "<a jump_to='"+d_s(date)+"' href='#'>"+month_x(date)+"</a>"; };
Best regards,
Ilya

Hi, ilya
That’s cool. Thank you!!!.

Hi,Ilya
It works but the page only turns to the dhx defined dailyview, but not my defined view when the hyperlink is clicked. it just only moved to the dhx defined dailyview even though i replaced the function.

For example, my code is something like that below:
scheduler.templates.month_day = function(date){
var str = ‘’;

  str=getNewmonthlyeffortCodeList(date.getMonth(),date.getDate());
       return "<a jump_to='"+link(date)+"'href='#' >"+format(date)+"</a>";
       //return "<a onclick='"+link(date)+"'href='#' >"+format(date)+"</a>";(just same result)



  }

};

function link(date){
actSubmit(document.dQueryMainForm, “/xxx/yyy/zzz/aaaFrom.dev” );
}

please let me know how to solve it.
thank you.

Hello,

Just below in the same source code:

dhtmlxEvent(this._obj,"click",function(e){ var start = e.target || event.srcElement; var to = start.getAttribute("jump_to"); if (to) { scheduler.setCurrentView(s_d(to),"unit"); if (e && e.preventDefault) e.preventDefault(); else if (window.event && window.event.returnValue) window.eventReturnValue = false; } })
You can comment this whole block as it served to listen for click event, check if there was ‘to’ property, convert it to date and move to another view.

Best regards,
Ilya

Dear Ilya,

I really appreciate your answer. It works as you mentioned above. Unfortunately, in spite of no cilick event, it jumps to the my defined page as soon as the scheduler is loaded. please let me know how to solve it.

It’s my code:
scheduler.templates.month_day = function(date){
var str = ‘’;

  str=getNewmonthlyeffortCodeList(date.getMonth(),date.getDate());
 //alert('str: '+str);
  if(str =='')
      //return format(date);
       return "<a jump_to='"+link(date)+"'href='#' >"+format(date)+"</a>";
  else{
       str='('+str+') ';
       str+=format(date);
       //return str
      return "<a  jump_to='"+link(date)+"' href='#' >"+str+"</a>";
  }

};

scheduler.init('scheduler',date,"month");

scheduler.attachEvent("click",function(e){
      var start = e.target || event.srcElement;
      var to = start.getAttribute("jump_to");
      if (to) {
         scheduler.setCurrentView(s_d(to),"unit");
         if (e && e.preventDefault) e.preventDefault();
         else
            if (window.event && window.event.returnValue)
               window.eventReturnValue = false;
      }
   });

Hello,

return "<a jump_to='"+link(date)+"'href='#' >"+format(date)+"</a>";

What is ‘link’ in your case?

Best regards,
Ilya

Hi, Ilya
it’s something like below:
function link(date){
actSubmit(document.xxxxForm, “<c:url value=”/dxx/oxx/xxxFrom.dev" />");
}

thank you for your concern!!

Hello,

So here

return "<a jump_to='"+link(date)+"'href='#' >"+format(date)+"</a>";

we directly execute link function with date as parameter which itself fires actSubmit(document.xxxxForm, "<c:url value="/dxx/oxx/xxxFrom.dev" />");
function and that makes specified link to be loaded from the start.

Best regards,
Ilya