Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Create a new appointment at single left click (Read 3041 times)
AncaZ
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Feb 16th, 2017
Create a new appointment at single left click
Mar 14th, 2017 at 10:10am
Print Post  
Hello,

How can I create an appointment when I press left click on a cell? Not drag and drop.
I see the method that caches the left click event is:
Code (Java)
Select All
 @Override
            public void dateClick(ResourceDateEvent e) { 


The problem is that here I don't have the item.
Do you have an example with the implementation of an Item object?

Thank you.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Create a new appointment at single left click
Reply #1 - Mar 14th, 2017 at 1:35pm
Print Post  
Hi,

Your approach is correct. Simply create a new item in the dateClick method by using the specified date (and resource, if applicable) and add it to the schedule:

Code
Select All
@Override
public void dateClick(ResourceDateEvent e) {
	calendar.resetDrag();
	Appointment app = new Appointment();
	app.setStartTime(e.getDate());
	app.setEndTime(e.getDate().addHours(2));
	if (e.getResource() != null)
		app.getResources().add(e.getResource());
	calendar.getSchedule().getItems().add(app);
} 


Note the call to resetDrag. This is done to terminate the interaction that will start in response to the left click (e.g. select).

Regards,
Meppy
« Last Edit: Mar 14th, 2017 at 2:55pm by Meppy »  
Back to top
 
IP Logged
 
AncaZ
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Feb 16th, 2017
Re: Create a new appointment at single left click
Reply #2 - Mar 14th, 2017 at 2:17pm
Print Post  
Works perfectly Smiley
Thank a lot.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint