React/ive Javascript Pivot Table Control

orb.pgridwidget

Options


dataSource

Pivot grid data source array. It can contain arrays or objects. When it is an array of objects, field names are object properties. When it is an array of arrays, field names are array indexes.

Type: Array
Default: null


dataHeadersLocation

Data headers location: 'rows' or 'columns'.

Type: String
Default: 'rows'


canMoveFields

Whether or not user can move fileds at runtime.

Type: Boolean
Default: true


grandTotal

Grand total settings. It contains the following sub options:

Type: Object
Default: { rowsvisible: true, columnsvisible: true }


subTotal

Global subtotals settings for row and column fiels. It contains the following sub options:

Type: Object
Default: { visible: true, collapsible: true, collapsed: false }


rowSettings

Global subtotals settings for row fields. It contains the following sub options:

Type: Object
Default: { subTotal: { visible: true, collapsible: true, collapsed: false }, sort: { order: null, customfunc: null } }


columnSettings

Global subtotals settings for column fields. It contains the following sub options:

Type: Object
Default: { subTotal: { visible: true, collapsible: true, collapsed: false }, sort: { order: null, customfunc: null } }


fields

Pivot grid fields mapping to data source fields. See Field options

Type: Array<Pivot grid field>
Default: null


rows

Array containing initial rows axe fields. It can contain:

Fields in this array should be defined first in the fields array.

Type: Array<Pivot grid field>
Default: null


columns

Array containing initial columns axe fields. It can contain:

Fields in this array should be defined first in the fields array.

Type: Array<Pivot grid field>
Default: null


data

Array containing initial data axe fields. It can contain:

Fields in this array should be defined first in the fields array.

Type: Array<Pivot grid field>
Default: null


preFilters

Defines how to filter data source before first building the pivot grid. Each property should map to either the caption or the name of one of the datasource fields. Property value should be an object with a single property having its name being one of the following operators:

And its value being either:

String comparison and regular expressions searches are always case-insensitive.

Example:

preFilters : {
    'Manufacturer': { 'Matches': /^c/i },      // Keep only Manufacturers starting with 'c'
    'Category'    : { 'Does Not Match': 'D' }, // Keep Categories that does not contain 'd'
    'Amount'      : { '>':  40 },              // Keep only Amounts > 40
    'Q'           : [4, 8, 12]                 // Keep Quantites in [4, 8, 12]
}

Type: Object
Default: null


toolbar

Toolbar configuration object:

The toolbar contains the following buttons:

Demo

Type: Object
Default: { visible: false }


theme

Defines Pivot grid theme. Should be one of the following values:

red
blue
green
orange
flower
gray
white
black
bootstrap


N.B.: bootstrap theme needs bootstrap css files to render properly.

Type: String
Default: 'blue'


width

Pivot grid width in pixel. A horizontal scroll bar appears when data to display needs more space. By default, the pivot grid extends horizontally as much as it needs.

Type: Number
Default: null


height

Pivot grid height in pixel. A vertical scroll bar appears when data to display needs more space. By default, the pivot grid extends vertically as much as it needs.

Type: Number
Default: null


Field options


A pivot grid field object is what describes the properties of a field when belonging to the different axes. It can be used in the fields, rows, columns and data options of the pivot grid.

Field options defined for rows, columns and data are only used when the pivot grid is first rendered and while the fields are not moved to other axes. These settings override the ones in fields.

Properties


name

Data source property name that this field will map.

Type: String
Default: null


caption

Field caption (displayed on buttons, ...).

Type: String
Default: field.name


subTotal

Same as pivot grid subTotal option but only applicable to current field. Overrides the global subtotal option.

Type: Object
Default: { visible: true, collapsible: true, collapsed: false }


sort

Defines sort settings:

Type: Object
Default: { order: null, customfunc: null }


aggregateFunc

Aggregate function when the field is dropped into the data axe. It can be one of the following predefined constants:

It can also be a custom aggregation function having the following signature:

function(datafield, intersection, datasource, rowIndexes, colIndexes): number

Where:

Returns:

aggregation result

Type: Object
Default: 'sum'


formatFunc

Data cell formatting function when the field is dropped into the data axe.

Signature: function(value), value: raw numeric value

Returns: formatted value to display in pivot grid data cells

Type: Function
Default: .toString()


rowSettings

Settings to use when this field is dropped in the rows axe.These settings override pivot grid fields settings.

Type: Pivot grid field
Default: null


columnSettings

Settings to use when this field is dropped in the columns axe.These settings override pivot grid fields settings.

Type: Pivot grid field
Default: null


dataSettings

Settings to use when this field is dropped in the data axe.These settings override pivot grid fields settings.

Type: Pivot grid field
Default: null

Methods


changeTheme

Changes the theme of the pivot grid. See theme option for possible values of themeName. If themeName is not valid, 'blue' theme will be applied.

Signature: changeTheme(themeName)
Returns: undefined


refreshData

Changes the datasource of the pivot grid. The pivot grid will be rebuilt, but sorting, filtering, sub totals collaped state will be retained.

Signature: refreshData(dataArray)
Returns: undefined