search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Create a new Resource booking in schedule by clicking on schedule date

Asked by John
16 years ago.

Hi,

I'm trying to setup the facility for a client to book a resource by clicking on specific day for a resource in the scheduler view. I use VB.net, so I'm finding the examples in C#/javascript a little hard to follow.

Do I have to use Javascript to achieve this functionality?

Whats the easiest way to achive this? Using events or javascript?

I've tried http://www.daypilot.org/howto-open-a-popup-window-for-entering-new-event.html but when I click on empty space nothing happens. When I click on an event I get "Microsoft JScritp runtime error: 'start' is undefined"

Comment posted by John
16 years ago.

Just noticed that I was using "EventClickJavaScript" instead of "TimeRangeSelectedJavaScript" in the schedular code.

So now nothing comes up when I click on an event, but the same "'Start' is undefined" error comes up when I click on an empty cell...

Help!

Answer posted by John
16 years ago.

News.

I tried using

TimeRangeSelectedHandling= "JavaScript"
TimeRangeSelectedJavaScript = "openPopup(start, end, column);"

and this as per example on site

function openPopup(e)
{
window.open('bookingPopupNew.aspx?start='
+ DayPilot.ds(start)
+ '&end=' + DayPilot.ds(end)
+ '&column=' + column,
'PopupDetail','width=400,Height=400,top=200,left=200');
}

This didnt work, got the error above.

I then tried another example

function newEvent(start, end, column)
{
document.location = 'bookingPopupNew.aspx?start='
+ encodeURIComponent(start.toUTCString())
+ '&end=' + encodeURIComponent(end.toUTCString())
+ '&column=' + encodeURIComponent(column);
}

This worked!

So I put it together into a dialog box showing details

function newBooking(start, end, column)
{
window.open('bookingPopupNew.aspx?start='
+ encodeURIComponent(start.toUTCString())
+ '&end=' + encodeURIComponent(end.toUTCString())
+ '&column=' + encodeURIComponent(column),
'PopupDetail','width=400,Height=400,top=200,left=200');
}

This works fine.

Can a VB examples section be put up on the site?

Cheers

John

Comment posted by Dan Letecky
16 years ago.
Oops, there was a typo in the example - it's fixed now. The openPopup() header should be

  function openPopup(start, end, column) {

rather than

  function openPopup(e) {

Thanks for posting the solution.

I'm working on the features documentation (DayPilotMonth and DayPilotScheduler are in progress now) and as soon as it's done I would like to add the VB.NET examples as well. Thanks for reminding this.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.