Hello
How do I go about changing the double click action on a schedule item so that rather than loading the lightbox, it loads an ASP.net edit page. Alternatively if they double click on a blank date then I want to load the create ASP.net page. The main complication is that I want to specify the page using a Dynamic HTML link in the form of Html.ActionLink or similar.
I hope I have explained it well enough. If not then ask me what specifics you require.
Any help would be appreciated.
Hello,
try handling “onEventAdded” and “onDblClick” events of the scheduler. In handlers you can change page location, or open edit page in new tab.scheduler.attachEvent("onEventAdded", function(id, event){
//redirect on create new event, pass selected date to the target controller
location.href = "Controller/Create?start_date=" + scheduler.templates.xml_format(event);
});
scheduler.attachEvent("onDblClick", function(id){
// redirect on double click on event, pass event id
location.href = "Controller/Edit?id=" + id;
});
In order to ensure that urls to the actions are correct, you can put this code on cshtml page and generate static part of the url with @Url.Action helper. E.g. :
scheduler.attachEvent("onDblClick", function(id){
// redirect on double click on event, pass event id
location.href = "@Url.Action("Edit", "Controller")?id=" + id;
});
Html.ActionLink generates a static html element, probably it is not what you need.
Thanks that is close to what I was looking for, however, I don’t want the popup box to open when I double click on a blank date. I want it to go directly to my custom create page. So what event would I implement to do that?
Hi,
try attaching to “onEventCreated” or “onBeforeEventChanged” instead of onEventAdded
scheduler.attachEvent("onEventCreated", function(id, event){
//redirect on create new event, pass selected date to the target controller
location.href = "Controller/Create?start_date=" + scheduler.templates.xml_format(event);
});
//OR
scheduler.attachEvent("onBeforeEventChanged", function(ev, e, is_new){
if(is_new){
//any custom logic here
location.href = "Controller/Create?start_date=" + scheduler.templates.xml_format(ev.start_date);
}
});
docs.dhtmlx.com/scheduler/api__s … event.html
docs.dhtmlx.com/scheduler/api__s … event.html