Adds a new field (or category) to the collection schema. The method throws an exception if the field already exits.
name |
A string that is the name of the field of the collectionField object to be added. |
text |
The text of this field that is displayed to the user in the user interface. |
type |
(Optional) A string that specifices the type of data associated with the field. Possible values are are listed below. S, a string type. A field with a string value. D, a date type. A field with a date value. N, a numeric type. A field with a numeric value. The following values identify the types of file-related fields: F, a field reserved for the file name of a member of the collection. Desc, a field reserved for a description string of a member of the collection. Size, a ield reserved for the file size of a member of the collection. ModDate, a field reserved for the modification date of a member of the collection. CreationDate, a field reserved for the creation date of a member of the collection. CompressedSize, a field reserved for the compressed file size of a member of the collection. The default is "S", a string type. |
order |
(Optional) An integer that indicates the order of the field in the display of the collection in the user interface. If this parameter is not specified, the new field is listed last. |
visible |
(Optional) A Boolean value that indicates the visibility of the field. The field is visible if the the value is true; not visible if false. The default is true. |
readOnly |
(Optional) A Boolean value, the field is read only if true. The default is false. If a field is read only, the user is not allowed to change the value of this field through the user interface. |
The collectionField object of the newly created field.
Create a new field in the collection called "to" using object literal techniques.
this.collection.addField({name:"to", order:3, text:"To", type:"S"});
// The same example as above, but using ordered parameters.
this.collection.addField("to", "To", "S", 3);
The getField method returns the collectionField object corresponding to the name of a collection field.
name |
A string that is the name of the field of the collectionField object to be retrieved. |
A collectionField object, or null if the field is not found.
Get the collectionField object of the "from" field.
var f = this.collection.getField("from");
Remove a field from the collection schema.
name |
A string that is the name of the field to be removed. |
Remove the "from" field from the collection schema.
this.collection.removeField("from");