Hello,
how can I attach an event to a pivotgrid inside a pivotview?
i'd like to expand the tuples, but the pivotview does not expose the event as the pivot grid does, and I can't seem to get the event to fire correctly.
thanks...
Hello Rob,
The easiest way to do this, is to find the igPivotGrid widget in the igPivotView and use the jQuery's "bind" function. Here is an example:
$("#pivotview").find('.ui-igpivotgrid').bind("igpivotgriddatasourceinitialized", function (evt, ui) { // Callback function code... });
That way you can bind to each event of the igPivotGrid. The same goes for the igPivotDataSelector - you just need to find the DOM element which contains the widget and use the "bind" function the same way. Hope this helps.
Thanks,
Martin Stoev
thanks, I tried this, but the event doesn't fire. I also don't get any errors.
dataSource = new $.ig.OlapXmlaDataSource({
serverUrl: 'http://sampledata.infragistics.com/olap/msmdpump.dll',
catalog: 'Adventure Works DW Standard Edition',
cube: 'Adventure Works',
rows: '[Date].[Calendar]',
columns: '[Product].[Product Key]',
// filters: '[Product].[Product Key]{[Product].[Product Key].&[AR-5381]}',
measures: '[Measures].[Internet Order Count]'
});
$('#pivotView').igPivotView({ dataSource: dataSource });
$("#pivotview").find('.ui-igpivotgrid').bind("igpivotgriddatasourceinitialized", function (evt, ui) {
alert('fgf');
Here is a jsFiddle using the pivotGridOptions of the pivotView to attach an event.
Hope this helps.
Philip
terrific thanks, that solved my problem...
It might be a good idea to expand the tuple members after the data source has been initialized - in the dataSourceInitialized event. In the pivot view from the fiddle above, this would look like:
//...
pivotGridOptions: {
dataSourceInitialized: function(evt, ui) { ui.owner.expandTupleMember("rowAxis", 0, 0, true); } },
I tried this and it seems to produce the desired result.
Let us know if you need further assistance.
Regards,
that worked for the data source initialization
I'm having a hard time trying to figure out how to expand the tuples within the pivotgrid inside a pivotview.
I've tried: $("#pivotview").find('.ui-igpivotgrid').igPivotGrid("expandTupleMember", "rowAxis", 0, 0, true);
I also tried getting a reference to the pivotgrid object like showed and calling the method:
$("#pivotView").igPivotView("pivotGrid").expandTupleMember("rowAxis", 0, 0, false);
Neither works.
thanks
Rob