Search
Item.location Property
See Also
 






Gets or sets the location associated with this Item.

Namespace: MindFusion.Scheduling
File: Item.js

 Syntax

JavaScript  Copy Code

get location() {}

 Property Value

An instance of the Location class.

 Example

The following code creates a new item for a birthday celebration that takes the whole present day and searches for the correct Location:

JavaScript  Copy Code

var p = MindFusion.Scheduling;

var date = p.DateTime.today();

// create a new item
var item = new p.Item();
item.subject = "Birthday Celebration";   
item.startTime = date;
item.endTime = p.DateTime.addDays(date.clone(),1);
item.allDayEvent = true;
item.location = getLocation(item.subject);
………
}

function getLocation(name)
{
 var location = calendar.schedule.locations.where(function(item){return (item.name === name)}).items()[0];
 
 // create a new location object and add it to the schedule's location collection
 if (!location)
 {
  location = new p.Location();
  location.name = name;
  calendar.schedule.locations.add(location);
 }
 return location;
}

 See Also