Methods

This section describes the methods used to manipulate the PivotGridDataSource object.

collapseAll(id)

Collapses all header items of a field.

Parameters:
id:

Number

|

String

The index in the fields array, dataField or caption of the field.

collapseHeaderItem(area, path)

Collapses a specified header item.

Parameters:
area:

String

Area whose header item should be collapsed.

path:

String

Path to an item.

dispose()

Disposes of all resources associated with this PivotGridDataSource.

Use this method only if you created the DataSource manually (not using a widget).

expandAll(id)

Expands all header items of a field.

Parameters:
id:

Number

|

String

The index in the fields array, dataField or caption of the field.

expandHeaderItem(area, path)

Expands a specified header item.

Parameters:
area:

String

Area whose header item should be expanded.

path:

String

Path to an item.

field(id)

Gets current options of a specified field.

Parameters:
id:

Number

|

String

The index in the fields array, dataField or caption of the field.

Return Value:

Object

Field options.

field(id, options)

Sets one or more options of a specified field.

Parameters:
id:

Number

|

String

The index in the fields array, dataField or caption of the field.

options:

Object

Option/value pairs object.

fields()

Gets all fields from the data source.

Return Value:

Array

Array of fields.

fields(fields)

Sets the fields option.

Parameters:
fields:

Array

Array of fields.

getAreaFields(area, collectGroups)

Gets all fields within a specified area.

Parameters:
area:

String

Area type.

collectGroups:

Boolean

Specifies whether to display groups as separate items.

Return Value:

Array

An array of fields.

If the collectGroups parameter is set to true, this method will return groups as separate items without going into their structure.

getData()

Gets data displayed in a PivotGrid.

Return Value:

Object

Pivot grid data.

To learn more about the structure of the returned object, refer to the Integration with Chart article.

NOTE
If you use XmlaStore and your data area is empty, this function will return values of the default measure, which were sent by an OLAP server. Although the OLAP server sends such values, they are hidden from the UI and can be obtained by this function only.

isLoading()

Indicates whether or not the PivotGridDataSource is currently being loaded.

Return Value:

Boolean

If the PivotGridDataSource is being loaded, it returns true; otherwise, it returns false.

load()

Starts loading data.

Return Value:

jQuery.Promise

A Promise of the jQuery.Deferred object is resolved when data has been loaded.

Use the following code to access loaded data.

JavaScript
dataSource.load()
    .done(function(result) {
        // 'result' contains the loaded data
    })
    .fail(function(error) {
        // handle error
    });

off(eventName)

Detaches all event handlers from the specified event.

Parameters:
eventName:

String

The name of the event to unsubscribe from.

Return Value:

Object

The object for which this method is called.

off(eventName, eventHandler)

Detaches a particular event handler from the specified event.

Parameters:
eventName:

String

The name of the event to unsubscribe from.

eventHandler:

function

The handler to be detached from the specified event.

Return Value:

Object

The object for which this method is called.

on(eventName, eventHandler)

Subscribes to a specified event.

Parameters:
eventName:

String

The name of the event to be subscribed.

eventHandler:

function

An event handler for the specified event.

Return Value:

Object

The object for which this method is called.

Use this method to subscribe to one of the events listed in the Events section.

See Also

on(events)

Subscribes to the specified events.

Parameters:
events:

Object

An object of the following structure: { "eventName1": handler1, "eventName2": handler2, ...}

Return Value:

Object

The object for which this method is called.

Use this method to subscribe to several events at one method call. Available events are listed in the Events section.

See Also