I'm trying to work with the ASP calendar control and (for starters) highlight the specific days on the calendar that matches DueDate in the 'task' table. I know how to highlight a cell using the DayRender event, but how do I do this in accordance to the database table?
Would then also like to be able to click on the highlighted cell and see details of the task associated to that date in some sort of box next to the calendar.
Any pointers on how I can solve this?
Pseudo-code:
Determine your desired date range (probably a certain month)
Read all the tasks that have due dates within that date range (probably need Name and DueDate at least)
In your DayRender handler you check if current day's date exists in the loaded tasks's due dates, if it does, highlight it with the color of your choice
In you SelectionChanged handler you obtain the selected day's date, and look through the loaded list of tasks for any tasks that have that date as their due date, and populate whatever box with those tasks.
Related
In Apex app I've a region called Person on a page. Inside a region there is a masked date picker. I have a task to validate the date of birth. So, the date of birth could not be less 1900 year. In "Conditions" section i'd been trying to write an pl/sql expression:
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01.01.1900', 'MM-DD-YYYY')
but it doesn't work. What am I doing wrong?
You put it to wrong place - "Condition" is used to decide whether an item will (or will not) be rendered on the screen.
Validation should be put into ... well, validation (obviously).
right-click the P1002_CONTR_BIRTH_DATE date picker item
choose "Create Validation"
set its type to "PL/SQL function (returning error text)
use such a code (presuming that you set the date picker format mask to MM-DD-YYYY):
if to_date(:P1002_CONTR_BIRTH_DATE, 'mm-dd-yyyy') < date '1900-01-01' then
return ('Error - can not set it to before 01-01-1900');
end if;
set it to fire when SUBMIT button is pressed
Alternatively (and way simpler) would be to open date picker item's property palette, navigate to its "Minimum date" property and put (for example) -120y in there which will allow dates that are higher than sysdate - 120 years (today, Apex would raise the
Birth date is less than specified minimum date 04-15-1898'
which isn't exactly "1900", but - you can easily calculate it, right? Also, -120y is somewhat more flexible than fixed year 1900.
Now you have two options, pick the one that suits you best.
TO_DATE() method is to convert a string to date, the string format should be the same as format_mask.
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01-01-1900', 'MM-DD-YYYY')
or
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01.01.1900', 'MM.DD.YYYY')
and also make sure :P1002_CONTR_BIRTH_DATE is also the same as format.
For detail
I have one getCMSField_forpopup form for an event. I made another popup inside that to give multiple dates to that event(using has_many relation). When I give date 2 different dates/times to event "A" and then after saving event "A", I open main getCMSField_forpopup to enter details of another event "B" then I see dates/times (complextablefield) already there which were actually meant to appear in event A's detail not in event "B". I want to see those only with A not with every new event. How can I make that possible ?
Your problem is that you enter Dates for 1 Event, but then you can see this Dates on every single Event?
to me this sounds like either your Event has no ID at this time and therefore a query on Dates "WHERE EventID = x" does not work, or your Dates get saved without the ID of the Event
You could simply check your database if your Dates have the ID of an Event set.
If the ID if the Event is 0, then the issue is that you are not saving the event ID, this either means that:
you have created the Dates before saving the Event, in this case the solution is just saving the Event before you add Dates, you could also hide the Dates field when it has not been saved, see below the $this->isNew() stuff
or silverstripe fails to save the EventID, in this case you could fix it by adding a hidden field to your getCMSFields_forPopup of the Date and save the Event ID there, but its gonna be a little tricky getting this ID into the popup
if this is not the issue, then the problem is that when you create a new Event it has no ID, and therefore can not filter by ID, you can simply do this inside your getCMSFields_forPopup of the Event:
if (!$this->isNew()) {
// add your ComplexTableField for Dates here so it only
// gets added if this record has already been saved
}
But actually I would recommend using nested DataObjectManager (a DataObjectManager inside a DataObjectManager)(see tutorial on youtube: http://youtu.be/eeXOTlXFmQQ), DataObjectManager does all that work for you, so this problem should not occur.
It only displays the DataObjectManager for Dates if you have already saved the Event once, otherwise it tells the user that he needs to save it first.
And it also sets the Event ID on the Dates for you
Or, even better, you could upgrade to SilverStripe 3, where you can use GridField.
GridField works way better then DataObjectManager and looks a lot nicer.
I have a event data which contains startdate and end date , i want to see the calendar holding that event,now what is happening is it is showing the current week calendar ,but if my event having previous week satrtdate means i have to go to previous week and and i can able to see the event data in calendar..but i want to focus that date calendar at first shot itself..pls do the needful its urgent, i think i have to change something in fullcalendar.js but i dont know where to change pls do needful
Check the documentation for FullCalendar... http://arshaw.com/fullcalendar/docs/current_date/
This shows parameters that can be set to get the calendar to initate at a particular date.. by default it will always start at todays date.
When an event is clicked, is there any way to determine which date this event falls on? Im running into this issue when dealing with events that span multiple days, and since the event only contains a start and end date, I have not found any way to ascertain which date of the multi-day event was selected.
You can pass additional fields into your JSON object when you bind up your events.
For example, I pass in a "leave" parameter that tells me whether an event is an appointment or a part of the day off.
I have a report where it shows meetings and their requirements. However i just want the report to show ONLY today's stuff--not the entire week's worth.
I tried setting my group header (i'm grouping by day) to currentdate but yet it still shows me the entire week. I then have to go to the grouping tree and select today's date. Is there any way to run my report and have it ONLY show today's stuff and nothing else???
Any ideas?
Use the select expert to limit the results to today's date. printdate is a special Crystal Formula keyword.
{table.date_field} = printdate
Or, if you're working with a datetime db field you can strip the time with CDate
CDate({table.date_field}) = printdate
One way would be to change your query so that it's only getting one day's worth of data; that is, assuming your data contains a date field. To take it a step further, you could add date parameters to the query itself and leave the group headers as is. That way, you can have one day of data, or data from a specific date range.
If you have no influence (or desire) to change the way data comes into Crystal Reports, you could also add a formula via the Section Expert to suppress the group or detail section unless the date is the current date.