|
source
|
Object
|
null
|
Gets or sets pivot source adapter used to supply data to the pivot grid.
Code example:
var column1Values =
[
'a', 'b', 'c', 'd'
];
var column2Values =
[
'e', 'f', 'g', 'h'
];
var column3Values =
[
'i', 'j', 'k', 'l'
];
var column4Values =
[
'2.25', '1.5', '3.0', '3.3', '4.5'
];
var myData = [];
for (var i = 0; i < 500; i++) {
var row = {};
row.column1 = column1Values[Math.floor(Math.random() * column1Values.length)];
row.column2 = column2Values[Math.floor(Math.random() * column2Values.length)];
row.column3 = column3Values[Math.floor(Math.random() * column3Values.length)];
row.column4 = parseFloat(column4Values[Math.floor(Math.random() * column4Values.length)]);
myData.push(row);
}
var source = {
localdata: myData,
datatype: 'array',
datafields:
[
{ name: 'column1', type: 'string' },
{ name: 'column2', type: 'string' },
{ name: 'column3', type: 'string' },
{ name: 'column4', type: 'number' }
]
};
var dataAdapter = new $.jqx.dataAdapter(source);
dataAdapter.dataBind();
// create a pivotDataSource from the dataAdapter
var pivotDataSource = new $.jqx.pivot(
dataAdapter,
{
pivotValuesOnRows: false,
rows: [{ dataField: 'column1' }, { dataField: 'column2'}],
columns: [{ dataField: 'column3'}],
values: [
{ dataField: 'column4', text: 'Sum of column4', 'function': 'sum'},
{ dataField: 'column4', text: 'Count of column4', 'function': 'count'}
]
});
// create a pivot grid
$('#divPivotGrid').jqxPivotGrid({
source: pivotDataSource
});
|
localization
|
Object
|
null
|
Gets or sets the localization object used to localize the text elements of the pivot grid.
Code example:
var customLocalizationObj = {
sortascendingstring: 'Sortiere aufsteigend',
sortdescendingstring: 'Sortiere absteigend',
sortremovestring: 'Entferne Sortierung'
};
$('#myPivotGrid').jqxPivotGrid({localization: customLocalizationObj});
|
scrollBarsEnabled
|
Boolean
|
true
|
Gets or sets whether the scrollbars of the pivot grid are enabled or disabled.
Code example:
$('#myPivotGrid').jqxPivotGrid({scrollBarsEnabled: false});
|
selectionEnabled
|
Boolean
|
true
|
Gets or sets whether selection in the pivot grid is enabled or disabled.
Code example:
$('#myPivotGrid').jqxPivotGrid({multipleSelectionEnabled: false});
|
multipleSelectionEnabled
|
Boolean
|
true
|
Gets or sets whether the multiple selection in the pivot grid is enabled or disabled.
Code example:
$('#myPivotGrid').jqxPivotGrid({multipleSelectionEnabled: false});
|
treeStyleRows
|
Boolean
|
true
|
Gets or sets the rows of the pivot grid are displayed as a tree structure or using classic OLAP style.
Code example:
$('#myPivotGrid').jqxPivotGrid({treeStyleRows: false});
|
autoResize
|
Boolean
|
false
|
Gets or sets if the size of pivot grid adjusts automatically to display the entire content.
Code example:
$('#myPivotGrid').jqxPivotGrid({treeStyleRows: true});
|
itemsRenderer
|
function
|
|
Custom rendering function used to render the pivot rows and columns. The function should return a string which is valid HTML.
Code example:
$('#myPivotGrid').jqxPivotGrid(
{
source: pivotDataSource,
itemsRenderer: function (pivotItem) {
var backgroundColor = pivotItem.isColumn ? 'rgba(187, 232, 227, 255)' : 'rgba(203, 254, 187, 255)';
return "<div style='background: "
+ backgroundColor
+ "; width: calc(100% - 8px); height: calc(100% - 8px); padding: 4px;'>"
+ pivotItem.text
+ "</div>";
},
cellsRenderer: function (pivotCell) {
var backgroundColor = 'rgba(253, 254, 207, 255)';
var cellText = pivotCell.value == 0 ? '' : pivotCell.formattedValue;
return "<div style='background: " + backgroundColor + "; width: calc(100%-8px); height: 100%; padding: 4px; margin: 0px;'>" + cellText + "</div>";
}
});
|
cellsRenderer
|
function
|
|
Custom rendering function used to render the pivot cells. The function should return a string which is valid HTML.
Code example:
$('#myPivotGrid').jqxPivotGrid(
{
source: pivotDataSource,
itemsRenderer: function (pivotItem) {
var backgroundColor = pivotItem.isColumn ? 'rgba(187, 232, 227, 255)' : 'rgba(203, 254, 187, 255)';
return "<div style='background: "
+ backgroundColor
+ "; width: calc(100% - 8px); height: calc(100% - 8px); padding: 4px;'>"
+ pivotItem.text
+ "</div>";
},
cellsRenderer: function (pivotCell) {
var backgroundColor = 'rgba(253, 254, 207, 255)';
var cellText = pivotCell.value == 0 ? '' : pivotCell.formattedValue;
return "<div style='background: " + backgroundColor + "; width: calc(100%-8px); height: 100%; padding: 4px; margin: 0px;'>" + cellText + "</div>";
}
});
|
|
pivotitemexpanding
|
Event
|
|
This event is triggered when a pivot item is expanding. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotitemexpanding event:
$('#myPivotGrid').on('pivotitemexpanding', function (event) {
alert('Pivot item expanding: ' + event.args.pivotItem.text);
});
|
pivotitemexpanded
|
Event
|
|
This event is triggered after a pivot item is expanded.
Code example:
Handling the pivotitemexpanded event:
$('#myPivotGrid').on('pivotitemexpanded', function (event) {
alert('Pivot item expanded: ' + event.args.pivotItem.text);
});
|
pivotitemcollapsing
|
Event
|
|
This event is triggered when a pivot item is collapsing. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotitemcollapsing event:
$('#myPivotGrid').on('pivotitemcollapsing', function (event) {
alert('Pivot item collapsing: ' + event.args.pivotItem.text);
});
|
pivotitemcollapsed
|
Event
|
|
This event is triggered after a pivot item is collapsed.
Code example:
Handling the pivotitemcollapsed event:
$('#myPivotGrid').on('pivotitemcollapsed', function (event) {
alert('Pivot item collapsed: ' + event.args.pivotItem.text);
});
|
sortchanging
|
Event
|
|
This event is triggered the sorting is about to change. You may use the event's cancel flag to stop further processing.
Code example:
Handling the sortchanging event:
$('#myPivotGrid').on('sortchanging', function (event) {
alert('Sort changing triggered. Pivot item: ' + event.args.pivotItem.text + ' , Sort order:' + event.args.sortOrder );
});
|
sortchanged
|
Event
|
|
This event is triggered after the sorting order has changed.
Code example:
Handling the sortchanged event:
$('#myPivotGrid').on('sortchanged', function (event) {
alert('Sort changed. Pivot item: ' + event.args.pivotItem.text + ' , Sort order:' + event.args.sortOrder );
});
|
sortremoving
|
Event
|
|
This event is triggered the sorting is about to be removed. You may use the event's cancel flag to stop further processing.
Code example:
Handling the sortremoving event:
$('#myPivotGrid').on('sortremoving', function (event) {
alert('Sort removing triggered. Pivot item: ' + event.args.pivotItem.text + ' , Sort order:' + event.args.sortOrder );
});
|
sortremoved
|
Event
|
|
This event is triggered after the sorting has been sortremoved.
Code example:
Handling the sortremoved event:
$('#myPivotGrid').on('sortremoved', function (event) {
alert('Sort removed. Pivot item: ' + event.args.pivotItem.text + ' , Sort order:' + event.args.sortOrder );
});
|
pivotitemselectionchanged
|
Event
|
|
This event is triggered after the selection of a pivot item has changed.
Code example:
Handling the pivotitemselectionchanged event:
$('#myPivotGrid').on('pivotitemselectionchanged', function (event) {
alert('Pivot item: ' + event.args.pivotItem.text + ' , selected:' + event.args.selected );
});
|
pivotcellmousedown
|
Event
|
|
This event is triggered on mousedown over a pivot grid cell. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotcellmousedown event:
$('#myPivotGrid').on('pivotcellmousedown', function (event) {
alert('cell mousedown, row: ' + event.args.pivotRow.text + ' , column:' + event.args.pivotColumn.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotcellmouseup
|
Event
|
|
This event is triggered on mouseup over a pivot grid cell. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotcellmouseup event:
$('#myPivotGrid').on('pivotcellmouseup', function (event) {
alert('cell mouseup, row: ' + event.args.pivotRow.text + ' , column:' + event.args.pivotColumn.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotcellclick
|
Event
|
|
This event is triggered on click over a pivot grid cell. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotcellclick event:
$('#myPivotGrid').on('pivotcellclick', function (event) {
alert('cell click, row: ' + event.args.pivotRow.text + ' , column:' + event.args.pivotColumn.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotcelldblclick
|
Event
|
|
This event is triggered on double click over a pivot grid cell. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotcelldblclick event:
$('#myPivotGrid').on('pivotcelldblclick', function (event) {
alert('cell double click, row: ' + event.args.pivotRow.text + ' , column:' + event.args.pivotColumn.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotitemmousedown
|
Event
|
|
This event is triggered on mousedown over a pivot grid item. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotitemmousedown event:
$('#myPivotGrid').on('pivotitemmousedown', function (event) {
alert('Pivot item mousedown: ' + event.args.pivotItem.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotitemmouseup
|
Event
|
|
This event is triggered on mouseup over a pivot grid item. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotitemmouseup event:
$('#myPivotGrid').on('pivotitemmouseup', function (event) {
alert('Pivot item mouseup: ' + event.args.pivotItem.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotitemclick
|
Event
|
|
This event is triggered on click over a pivot grid item. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotitemclick event:
$('#myPivotGrid').on('pivotitemclick', function (event) {
alert('Pivot item click: ' + event.args.pivotItem.text + ' , mouse button:' + event.args.mousebutton );
});
|
pivotitemdblclick
|
Event
|
|
This event is triggered on double click over a pivot grid item. You may use the event's cancel flag to stop further processing.
Code example:
Handling the pivotitemdblclick event:
$('#myPivotGrid').on('pivotitemdblclick', function (event) {
alert('Pivot item double click: ' + event.args.pivotItem.text + ' , mouse button:' + event.args.mousebutton );
});
|
|
getInstance
|
Method
|
|
Returns the instance of the pivot grid component
Code example:
var myPivotGridInstance = $('#myPivotGrid').jqxPivotGrid('getInstance');
|
refresh
|
Method
|
|
Refreshes the content of the pivot grid component
Code example:
$('#myPivotGrid').jqxPivotGrid('refresh');
|
destroy
|
Method
|
|
Destroys the pivot grid component instance
Code example:
$('#myPivotGrid').jqxPivotGrid('destroy');
|
getPivotRows
|
Method
|
|
Return the pivot rows of the pivot grid
Code example:
var myPivotGridRows = $('#myPivotGrid').jqxPivotGrid('getPivotRows');
alert('The pivot grid has ' + myPivotGridRows.items.length + ' rows.');
|
getPivotColumns
|
Method
|
|
Return the pivot columns of the pivot grid
Code example:
var myPivotGridColumns = $('#myPivotGrid').jqxPivotGrid('getPivotColumns');
alert('The pivot grid has ' + myPivotGridColumns.items.length + ' columns.');
|
getPivotCells
|
Method
|
|
Return the pivot cells of the pivot grid
Code example:
var myPivotGridCells = $('#myPivotGrid').jqxPivotGrid('getPivotCells');
|