FormatContents class (Pivot)

FormatContents(oPivot)

new FormatContents(oPivot)

The FormatContents object holds the content-formats to apply on the pivot control. For instance, you can display the values in numeric format. The FormatContents / GetFormatContents() method returns the control's format-contents that specifies how a column or row can be displayed, formatted or converted.

By default, the FormatContents collection contains the following objects:

  • "numeric", to show the cells in numeric format
  • "currency", to show the cells as currency
  • "date", to show the cells in date format
Parameters:
Name Type Description
oPivot Pivot Indicates an object of Pivot type that owns the collection
Example
oPivot.FormatContents.Add({key: "upper", expression: "type(value) = 4 ? upper(value) : value format ``"}), shows the value in uppercase.
FormatContents

Methods

Add(oFormatOptions) → {FormatOptions}

The Add() method adds/updates the format based on its key
Parameters:
Name Type Description
oFormatOptions object Indicates an object of FormatOptions type that holds attributes of the format to add/replace
Returns:
Returns undefined (no key provided), or an the object being added of FormatOptions type that holds attributes of the format being added
Type
FormatOptions
Add

Clear()

The Clear() method clears the FormatOptions objects within the collection
Clear

GetCount() → {number}

The GetCount() method returns the number of FormatOptions objects within the collection
Returns:
Returns the number of FormatContents within the collection
Type
number
GetCount

Item(key) → {FormatOptions}

The Item() property gets the format based on the key
Parameters:
Name Type Description
key string Specifies the key of the format to request
Returns:
Returns undefined (no format found), or an the object being added of FormatOptions type that holds attributes of the format being added
Type
FormatOptions
Item

Remove(key) → {boolean}

The Remove() method removes the format giving its key
Parameters:
Name Type Description
key string Specifies the key of the format to remove
Returns:
Returns true, if the key has been removed
Type
boolean
Remove

forEach(callback, thisArg)

The forEach() method enumerates the FormatOptions objects within the current collection
Parameters:
Name Type Description
callback callback Indicates a function of callback(oFormatOptions) type, where
oFormatOptions {object}, indicates the format of FormatOptions type
thisArg any Specifies the value of "this" keyword during the callback. If missing it refers to the current collection.
forEach