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

Scheduler Question

Asked by Walter
14 years ago.

Hello all,

i'm currenly working on a appointment system that uses the scheduler controll.
I'm running into a problem with a event thats stretched over more days.

its like this:
the event starts on 5 december and ends on 7 december.
I also have some events that occur on the 6th of december, but when i click on the stretched event with the crosshair on the 6th i only get the start date and enddate value.

Is there a possibility that i can get the value of the 6th when i click on that day in the event(the stretched event)?

I hope you understand my problem because i didn't know how to explain it otherwise.

Greets,

Walter

Comment posted by Dan Letecky
14 years ago.

You can get the mouse coordinates relative to the event box using dps1.eventOffset property (where "dps1" is the value of ClientObjectName property of the Scheduler). See also an example in Demo/Scheduler/Default.aspx in the download package:

<DayPilot:MenuItem Action="JavaScript" JavaScript="alert('x:' + dps1.eventOffset.x + ' y:' + dps1.eventOffset.y + ' resource:' + e.row());" 
Text="Mouse offset (relative to event)" />

When you are showing a full timeline (i.e. ShowNonBusiness="true") you can convert it easily to milliseconds by calling dps1.pixelsToTicks(dps1.eventOffset.x).

The exact time would be:

e.start().addTime(dps1.pixelsToTicks(dps1.eventOffset.x));

as DayPilot.Date object.

For ShowNonBusiness="false" it would be more complicated, i.e. you would have to convert the event start to pixels first, than add pixels and convert the result back to date. Please let me know if you need that.

Comment posted by Walter
14 years ago.

Thx for the reply, i am only a bit confused on where to put the

e.Start().addTime(dps.pixelsToTicks(dps.eventOffset.x));
code.
Comment posted by Dan Letecky
14 years ago.

You need to switch to JavaScript event click handling:

EventClickHandling="JavaScript"

The code above should be run from the JavaScript event handler, e.g.:

EventClickJavaScript="eventClicked(e)"

<script type="text/javascript">
function eventClicked(e) {
var timePointClicked = e.start().addTime(dps1.pixelsToTicks(dps1.eventOffset.x));
alert(timePointClicked);
}
</script>

Comment posted by Walter
14 years ago.

I see,

it worked.

In my scheduler i use Appointments and Tasks. The tasks belong to a appointment.
and thats why i asked my question in my first post.

because the event thats starts on 5 dec and ends on 7 december can't catch data from the 6th.

i have a contextmenu on my events that if you click it, it will open a popup with the calender controll and it will show all the tasks that belong to the appointment.

But with a event thats stretched over more days, it won't since you only have the start and end date.

Is there a possibility that the solution you gave, could be used in my c# for opening the popup?

this is the code for popup

        protected void dpsRoster_EventMenuClick(object sender, EventMenuClickEventArgs e)
        {
            
            string EventID = e.Tag["EventID"];//gebruiken bij afspraken
            string EventType = e.Tag["Eventtype"];//gebruiken bij taken.
            switch (e.Command)
            {
                case "ShowDayInfo":
                   string url = "frmDayInfo.aspx?start=" + e.Start.ToShortDateString() + "&r=" + e.ResourceId+"&eventtype="+EventType + "&eventid="+EventID;
                    ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("window.open('{0}','null','left=400, top=100, height=500, width= 700, status=no, resizable=no, scrollbars=no, toolbar=no, location=no, menubar=no');", url));   
                    break;
            }
        }


Comment posted by Mike
14 years ago.

I have tried to use your example function - eventClicked(e), but I get an error 'e' is undefined. Can you explain how I can use this.

Thanks

Mike

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.