ASP.NET MVC Controls | ComponentOne
In This Topic
    CubePivotField Class
    In This Topic
    File
    wijmo.olap.js
    Module
    wijmo.olap
    Base Class
    PivotField

    Extends the PivotField class to represent a field in a server-based cube data source.

    Constructor

    Properties

    Methods

    Events

    Constructor

    constructor

    constructor(engine: PivotEngine, binding: string, header?: string, options?: any): CubePivotField
    

    Initializes a new instance of the CubePivotField class.

    Parameters
    Optional

    Header shown to identify this field (defaults to the binding).

    JavaScript object containing initialization data for the field.

    Returns
    CubePivotField

    Properties

    aggregate

    Gets or sets how the field should be summarized.

    The default value for this property is **Aggregate.Sum** for numeric fields, and **Aggregate.Count** for other field types.

    Inherited From
    PivotField
    Type
    Aggregate

    align

    Gets or sets the horizontal alignment of this field's cells.

    The default value for this property is null, which causes the grid to select the alignment automatically based on the fields's dataType (numbers are right-aligned, Boolean values are centered, and other types are left-aligned).

    If you want to override the default alignment, set this property to 'left', 'right', 'center', or 'justify'.

    Inherited From
    PivotField
    Type
    string

    binding

    Gets or sets the name of the property the field is bound to.

    Inherited From
    PivotField
    Type
    string

    collectionView

    Gets the ICollectionView bound to this field.

    Inherited From
    PivotField
    Type
    ICollectionView

    dataType

    Gets or sets the data type of the field.

    Inherited From
    PivotField
    Type
    DataType

    descending

    Gets or sets a value that determines whether keys should be sorted in descending order for this field.

    The default value for this property is **false**.

    Inherited From
    PivotField
    Type
    boolean

    dimensionType

    Gets or sets the dimension type of the field.

    Type
    DimensionType

    engine

    Gets a reference to the PivotEngine that owns this PivotField.

    Inherited From
    PivotField
    Type
    PivotEngine

    filter

    Gets a reference to the PivotFilter used to filter values for this field.

    For measure fields in cube data sources, the filter is applied to aggregated cell values. For measure fields in non-cube data sources, the filter is applied to the raw data.

    Inherited From
    PivotField
    Type
    PivotFilter

    format

    Gets or sets the format to use when displaying field values.

    The default value for this property is **"d"** for date fields, **"n0"** for numeric fields, and the empty string for other field types.

    Inherited From
    PivotField
    Type
    string

    getAggregateValue

    Gets or sets a function to be used for retrieving the field's **aggregate** value for a given summary object.

    The default value for this property is **null**, causing the engine to use the field's aggregate and showAs properties to calculate the aggregate.

    If specified, the function should take a single parameter that represents the summary object generated by the engine and should return the aggregate value for the item.

    Notice the difference between the getValue property (a function that takes a raw data item and returns a raw value), and the getAggregateValue (a function that takes a summary object and returns an aggregate value):

    ```typescript fields: [ { header: 'Conversion (per summary row)', dataType: 'Number', format: 'p0',

    // getAggregateValue computes an aggregate from a summary row (Downloads, Sales) // **NOTE**: for this formula to work, the "Downloads" and "Sales" fields must be // present in the PivotEngine's valueFields array. getAggregateValue: row => row.Downloads ? row.Sales / row.Downloads : 0 }, { header: 'Conversion (per raw data item)', dataType: 'Number', aggregate: 'Avg', format: 'p0',

    // getValue computes a raw value from a data item (downloads, sales) getValue: item => item.downloads ? item.sales / item.downloads : 0 }, ```

    {@sample OLAP/PivotPanel/Fields/Customize/FieldSettingsDialog/Calculated Example}

    Inherited From
    PivotField
    Type
    Function

    getValue

    Gets or sets a function to be used for retrieving the field value for a given data item.

    This property is set to null by default, causing the engine to use the field's binding property to retrieve the value.

    If specified, the function should take a single parameter that represents the data item being evaluated and should return the calculated value for the item.

    Notice the difference between the getValue property (a function that takes a raw data item and returns a raw value), and the getAggregateValue (a function that takes a summary object and returns an aggregate value):

    ```typescript fields: [ { header: 'Conversion (per summary row)', dataType: 'Number', format: 'p0',

    // getAggregateValue computes an aggregate from a summary row (Downloads, Sales) getAggregateValue: row => row.Downloads ? row.Sales / row.Downloads : 0 }, { header: 'Conversion (per raw data item)', dataType: 'Number', aggregate: 'Avg', format: 'p0',

    // getValue computes a raw value from a data item (downloads, sales) getValue: item => item.downloads ? item.sales / item.downloads : 0 }, ```

    {@sample OLAP/PivotPanel/Fields/Customize/FieldSettingsDialog/Calculated Example}

    Inherited From
    PivotField
    Type
    Function

    isActive

    Gets or sets a value that determines whether this field is currently being used in the view.

    Setting this property to true causes the field to be added to the view's rowFields or valueFields, depending on the field's data type.

    Inherited From
    PivotField
    Type
    boolean

    isContentHtml

    Gets or sets a value indicating whether items in this field contain HTML content rather than plain text.

    The default value for this property is **false**.

    Inherited From
    PivotField
    Type
    boolean

    isMeasure

    Overridden to account for the dimension type.

    Type
    boolean

    key

    Gets the key for this CubePivotField.

    For this type of field, the key is the field's binding.

    Type
    string

    parentField

    Gets this field's parent field.

    When you drag the same field into the Values list multiple times, copies of the field are created so you can use the same binding with different parameters. The copies keep a reference to their parent fields.

    Inherited From
    PivotField
    Type
    PivotField

    showAs

    Gets or sets a value that specifies how to display the aggregate value.

    Options for this property are defined by the ShowAs enumeration and include differences between the value and the one in the previous row or column, percentages over the row, column, or grand total, and running totals.

    This property is similar to the Show Values As feature in Excel.

    The default value for this property is **ShowAs.NoCalculation**.

    Inherited From
    PivotField
    Type
    ShowAs

    sortComparer

    Gets or sets a function used to compare values when sorting.

    This sortComparer property is effective for the fields specified in the columnFields and columnFields properties only.

    If provided, the sort comparer function should take as parameters two values of any type, and should return -1, 0, or +1 to indicate whether the first value is smaller than, equal to, or greater than the second. If the sort comparer returns null, the standard built-in comparer is used.

    This sortComparer property allows you to use custom comparison algorithms that in some cases result in sorting sequences that are more consistent with user's expectations than plain string comparisons.

    The example below shows a typical use for the sortComparer property:

    // define list of products
    app.products = 'Wijmo,Aoba,Olap,Xuni'.split(',');
    
    // sort products by position in the 'app.products' array
    ng.viewDefinitionChanged.addHandler(function () {
      var fld = ng.fields.getField('Product');
      if (fld) {
        fld.sortComparer = function (val1, val2) {
          return app.products.indexOf(val1) - app.products.indexOf(val2);
        }
      }
    });
    
    Inherited From
    PivotField
    Type
    Function

    subFields

    Gets this field's child fields.

    Inherited From
    PivotField
    Type
    PivotField[]

    visible

    Gets or sets a value indicating whether this field should be displayed in instances of the PivotPanel control.

    The default value for this property is **true**.

    Setting this property to false hides the field any PivotPanel controls, preventing users from adding, removing, or changing the the field position in the engine's view definition.

    Inherited From
    PivotField
    Type
    boolean

    weightField

    Gets or sets the PivotField used as a weight for calculating aggregates on this field.

    If this property is set to null, all values are assumed to have weight one.

    This property allows you to calculate weighted averages and totals. For example, if the data contains a 'Quantity' field and a 'Price' field, you could use the 'Price' field as a value field and the 'Quantity' field as a weight. The output would contain a weighted average of the data.

    Inherited From
    PivotField
    Type
    PivotField

    width

    Gets or sets the preferred width to be used for showing this field in user interface controls such as the PivotGrid.

    Inherited From
    PivotField
    Type
    number

    wordWrap

    Gets or sets a value that indicates whether the content of this field should be allowed to wrap within cells.

    The default value for this property is **false**.

    Inherited From
    PivotField
    Type
    boolean

    Methods

    onPropertyChanged

    onPropertyChanged(e: PropertyChangedEventArgs): void
    

    Raises the propertyChanged event.

    Parameters
    Inherited From
    PivotField
    Returns
    void

    Events

    propertyChanged

    Occurs when the value of a property in this Range changes.

    Inherited From
    PivotField
    Arguments
    PropertyChangedEventArgs