This mixin contains the store management.
See the dojox/calendar/StoreMixin reference documentation for more information.
Used across all instances a hash to cache attribute names and their getter and setter names.
The attribute of the store item that contains the all day state of the events represented by this item. Default is "allDay".
Optional function that returns a css class name to apply to item renderers that are displaying the specified item in parameter.
An optional function to transform store date into Date objects. Default is null.
Whether the data items displayed must be recomputed, usually after the displayed time range has changed.
An optional function to transform Date objects into store date. Default is null.
The attribute of the store item that contains the end time of the events represented by this item. Default is "endTime".
The attribute of the store item that contains the start time of the events represented by this item. Default is "startTime".
The attribute of the store item that contains the sub column name of the events represented by this item. Default is "calendar".
The attribute of the store item that contains the summary of the events represented by this item. Default is "summary".
Internal helper for directly changing an attribute value.
Directly change the value of an attribute on an object, bypassing any accessor setter. Also handles the calling of watch and emitting events. It is designed to be used by descendant class when there are two values of attributes that are linked, but calling .set() is not appropriate.
Parameter | Type | Description |
---|---|---|
name | String | The property to set. |
value | Mixed | The value to set in the property. |
Internal helper for directly changing an attribute value.
Parameter | Type | Description |
---|---|---|
id | undefined |
Computes the data items that are in the displayed interval.
Parameter | Type | Description |
---|---|---|
renderData | Object | The renderData that contains the start and end time of the displayed interval. |
Private function that does a get based off a hash of names
Parameter | Type | Description |
---|---|---|
name | undefined | |
names | undefined | Hash of names of custom attributes |
Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.
Parameter | Type | Description |
---|---|---|
name | undefined |
Parameter | Type | Description |
---|---|---|
renderData | undefined |
Parameter | Type | Description |
---|---|---|
item | Object | |
state | String |
Get a property on a Stateful instance.
Get a named property on a Stateful object. The property may potentially be retrieved via a getter method in subclasses. In the base class this just retrieves the object's property.
Parameter | Type | Description |
---|---|---|
name | String | The property to get. |
The property value on this Stateful instance.
require(["dojo/Stateful", function(Stateful) { var stateful = new Stateful({foo: 3}); stateful.get("foo") // returns 3 stateful.foo // returns 3 });
Returns the creation state of an item. This state is changing during the interactive creation of an item. Valid values are: - "unstored": The event is being interactively created. It is not in the store yet. - "storing": The creation gesture has ended, the event is being added to the store. - "stored": The event is not in the two previous states, and is assumed to be in the store (not checking because of performance reasons, use store API for testing existence in store). item: Object The item. returns: String
Parameter | Type | Description |
---|---|---|
item | undefined |
Creates the render item based on the dojo.store item. It must be of the form:
{ id: Object, startTime: Date, endTime: Date, summary: String }
By default it is building an object using the store id, the summaryAttr,
startTimeAttr and endTimeAttr properties as well as decodeDate property if not null. Other fields or way to query fields can be used if needed.
Parameter | Type | Description |
---|---|---|
item | Object | The store item. |
store | dojo.store.api.Store | The store. |
Create a store item based on the render item. It must be of the form:
{ id: Object startTime: Date, endTime: Date, summary: String }
By default it is building an object using the summaryAttr, startTimeAttr and endTimeAttr properties
and encodeDate property if not null. If the encodeDate property is null a Date object will be set in the start and end time. When using a JsonRest store, for example, it is recommended to transfer dates using the ISO format (see dojo.date.stamp). In that case, provide a custom function to the encodeDate property that is using the date ISO encoding provided by Dojo.
Parameter | Type | Description |
---|---|---|
renderItem | Object | The render item. |
store | dojo.store.api.Store | The store. |
Set a property on a Stateful instance
Sets named properties on a stateful object and notifies any watchers of the property. A programmatic setter may be defined in subclasses.
Parameter | Type | Description |
---|---|---|
name | String | The property to set. |
value | Object | The value to set in the property. |
The function returns this dojo.Stateful instance.
require(["dojo/Stateful", function(Stateful) { var stateful = new Stateful(); stateful.watch(function(name, oldValue, value){ // this will be called on the set below } stateful.set(foo, 5);
set() may also be called with a hash of name/value pairs, ex:
stateful.set({ foo: "Howdy", bar: 3 }); });
This is equivalent to calling set(foo, "Howdy") and set(bar, 3)
Watches a property for changes
Parameter | Type | Description |
---|---|---|
name | String |
Optional Indicates the property to watch. This is optional (the callback may be the only parameter), and if omitted, all the properties will be watched |
callback | Function | The function to execute when the property changes. This will be called after the property has been changed. The callback will be called with the |this| set to the instance, the first argument as the name of the property, the second argument as the old value and the third argument as the new value. |
An object handle for the watch. The unwatch method of this object can be used to discontinue watching this property:
var watchHandle = obj.watch("foo", callback); watchHandle.unwatch(); // callback won't be called now