Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic WeekView Question (Read 3229 times)
alanmcgeough
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 34
Joined: Dec 17th, 2007
WeekView Question
Apr 21st, 2008 at 9:30am
Print Post  
Hi to all,

i have been using the planner for some time, at the moment i can use the groupby locations type, and the currentview set to timetable. so what i have is the locations going across the top for example bay1,bay2,bay3 all for 1 day and the user can scoll true each day or click on a day on another calendar and it will selected that date. this is all fine.

I was wondering what is the best way to show a week view for a selected loaction for example if the user clicks on bay1 location the planner will only show that location and show the 5 days instead of 1. the reason for this is that in the future i might want to change the locations - bays to mechanics so it would be useful to be able to click on the location and see the weekview for that locations and then obviously then be able to change it back.

any advice would be great.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: WeekView Question
Reply #1 - Apr 21st, 2008 at 10:06am
Print Post  
Here is a possible realization of your requirement:

Setup the timetable view with the required number of locations and days, enable grouping, and so on. Handle the TimetableColumnHeaderClick event. This event is fired when the user clicks on any of the Timetable column headers. Since at the moment you cannot distinguish whether the user clicked on the date header or on a location header, you can use the Calendar.GetLocationAt method with the center of the DateEventArgs.Bounds property to retrieve a reference to the location associated with the clicked header. If this is null, the user clicked on the date header.

To switch the view to show the items of the clicked location, do the following:

Code
Select All
calendar.BeginInit();
calendar.Locations.Clear();
calendar.Locations.Add(location);
calendar.GroupType = GroupType.FilterByLocations;
calendar.EndInit(); 


where location is the reference of the location whose items to display. Also make sure you specify the required number of display dates through the TimetableSettings.Dates and TimetableSettings.VisibleColumns properties.

To return back to the grouped view, you ca use an external button on your interface, or another click on any of the timetable headers. Simply revert the value of the GroupType property and the previously selected locations.

Meppy
  
Back to top
 
IP Logged
 
alanmcgeough
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 34
Joined: Dec 17th, 2007
Re: WeekView Question
Reply #2 - Apr 21st, 2008 at 11:08am
Print Post  
Thanks for that meepy i understand how i can get the location Id but I cant seem to have more then 1 day showing up on the timetable setting, I have added more days to the _schedule.TimetableSettings.Dates setting
but only one day shows up even when i have added more then 1 day so if i have, your solution will probably work i will base the changing view on a button and revert back to normal 1 
day view when user clicks back. when i click on one of the locations the view will then change from 1 day to say 5 days with only that location showing until the user clicks back. so what you get is a week  view of that specific location. but as i say i cant seem to have more then 1day showing.

any advice would be great thanks again

Alan
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: WeekView Question
Reply #3 - Apr 21st, 2008 at 11:28am
Print Post  
Set the VisibleColumns property of the Calendar.TimetableSettings object to the number of columns you would like to have visible at once (lets say 5).

Hope that helps.

Meppy
  
Back to top
 
IP Logged
 
alanmcgeough
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 34
Joined: Dec 17th, 2007
Re: WeekView Question
Reply #4 - Apr 22nd, 2008 at 9:39am
Print Post  
Thats worked great meppy just one last thing we i click  on the location i use the getlocationAt to find the location that was clicked on then i show five days for that location which is also scrollable,

just wondering can i put the location.name on top of the control so the user knows which location there looking at or do i just need a label and pass in the location.name to the label???   

i have a menu - (Standard view) which lets the user back to the normal one day group by locations view.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: WeekView Question
Reply #5 - Apr 22nd, 2008 at 11:29am
Print Post  
You can do this easily by making the following modifications:

1. Instead of specifying FilterByLocation when a location header is hit, replace it with the following line:

Code
Select All
calendar.TimetableSettings.ReverseGrouping = State.Enabled; 


This will effectively reverse the headers position by placing the location header above the date headers.

2. When you turn back to group view, disable reversed grouping, by setting the value of the property to Disabled.

Meppy
  
Back to top
 
IP Logged
 
alanmcgeough
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 34
Joined: Dec 17th, 2007
Re: WeekView Question
Reply #6 - Apr 22nd, 2008 at 1:20pm
Print Post  
excellent excellent, just one thing i have notice i have a getItems function which is used to get the bookings from the database. Obviously if im just showing 1day i can clear the appointments and call it again for the next selected day so i use the calendar.scedule.clear which clears the items.I have came across an error when i try to add an appointment that is already on the planner. I had to change alot of my code to make sure that the getItems function(date, depotId) does not clear the items if im am showing more then one day for the location, previously my application cleared the items but obvoiusly if im using the getItems function to get the items for multiple days i dont want to clear the planner any ideas.

any way to stop the planner adding the appointment if it already exists on the planner based on app.id ???
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: WeekView Question
Reply #7 - Apr 22nd, 2008 at 1:29pm
Print Post  
Can't you just check whether the Schedule.Items collection already contains an appointment with specific id before attempting to add it?

Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint