|
Whitebeam Object Definition
|
Method Description
Interest.constructor()
Create a new JavaScript Interest object.
Syntax
Interest = Interest.constructor(initData)
Parameters
The 'Interest.constructor' method takes 1 parameter:
Name | Type/Value | Range/Length | Description | initData | MetaData | | Optional. JS object containing initialisation fields for the the Interest object. |
Results
The 'Interest.constructor' method returns Interest:
Type/Value | Range/Length | Description |
Interest |
  |
Returns the newly created Interest object.
The most common way of obtaining the initialisation data is through a form submition - where the names of the
fields on the form match the property names of the Interest object. This can be seen in the following example.
|
Remarks This is the JavaScript constructor for the 'Interest' class. The constructor takes a single optional parameter - initData.
If this parameter is absent the constructor creates an empty Interest object - ready to be used by the application. If initData is
present then the following steps are taken: - The uName and ID property of initData are checked - if either are present the code attempts to load the corresponding
Interest Group from the persistent store.
- initData is then searched for properties with names corresponding to Interest properties. Those that are found are copied
to the initialised Interest object - overlaying those values over the top of any values currently stored in the object.
The second part of this initialisation takes place whether or not any values were recovered from the persistent interest group store! This method is invoked indirectly through a statement such as: var anInterestGroup = new Interest(initData);
|
The new interest group is not added to the persisitent store - and no changes from the initialisation data are
committed to the persistent data store until the 'save' or 'create' method are invoked on the object.
|
Example
// Create a new interest group using the values stored
// provided by the user completing a form.
var formData = rb.page.formdata();
var anInterestGroup = new Interest(formData);
// So far all we've done is create a JavaScript object. Need
// to store this permanently.
anInterestGroup.create();
|
|
(loadtime : 9ms) |