Hi, anyone can help me for I can activate the dialogbox to save and load datasource customizations with OLAP Pivot View? for jQuery like http://ko.infragistics.com/samples/wpf/pivot-grid/save-and-load-data-source-customizations.
Thanks.
J.
Hello Joan,
There is no out of the box dialog box to save and load igPivotGrid/igPivotView customizations and we don't have one on the igniteui.com site. You should implement it by yourself.
To get you started I'm attaching a sample on how to save/load igPivotGrid rows/columns/measures state from Local Storage.
Please note that the sample doesn't save the expanded/collapsed states of the measures as well as any applied filters.
Best regards,Martin PavlovInfragistics, Inc.
Hi Martin, thank you very much, this sample is awesome.
can you help me to know how can I save the expanded/collapsed states of the colums or rows of the data as well as any applied filters at the same time.
I using $("#pivotView").igPivotView({...});
thanks again.
regards.
You can get the specified filters the same way the rows and measures are retrieved, for example:
filters = $("#pivotGrid").igPivotGrid("option", "dataSource").filters()
And they can also be set in the exact same way.
The expansion states however are not persisted in the data source so in order to get them you need to add an event handler for the tupleMemberExpanded/ tupleMemberCollapsed events:
http://www.igniteui.com/help/api/2016.1/ui.igPivotGrid#events:tupleMemberExpanded
http://www.igniteui.com/help/api/2016.1/ui.igPivotGrid#events:tupleMemberCollapsed
and use them in order to track what is current expanded/collapsed and save the related states. Then when the grid is rendered again you can expand the related tuple members via the expandTupleMember API method:
I’ve modified the sample with these changes for you reference. Let me know if you have any additional questions or concerns.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://ko.infragistics.com/support
Hi Maya, thank you very much!, this is a nice script, I've try integrated the script with $.ig.OlapXmlaDataSource instead of $.ig.OlapFlatDataSource like your sample, but I can't get it, it is posible?, I attach my script, can you help me to check this out? thanks again!
Regards.
Joan.
The dataSourec optioins should be defined as a simple json object, no need to instantiate a OlapXmlaDataSource on the options as they’ll need to be extended with the options stored in localStorage.
Example:
var dsOptions = {
serverUrl: 'http://sampledata.infragistics.com/olap/msmdpump.dll',
catalog: 'Adventure Works DW Standard Edition',
cube: 'Adventure Works',
rows: "[Ship Date].[Calendar]",
columns: "[Delivery Date].[Calendar]",
measures: "[Measures].[Product Gross Profit Margin Status],[Measures].[Product Gross Profit Margin Goal]",
};
Also to have the expansion states re-applied you’ll have to wait for the grid to fully render before calling the expandTupleMember API method because if it’s called while the remote data is still loading the grid will not have anything to expand and the change won’t be applied.
You can handle the pivotGridRendered event and reaply the expansion states there after the loadState function was called, for example:
function loadState() {
createGrid(JSON.parse(localStorage.getItem("s1")));
expanded = JSON.parse(localStorage.getItem("expanded"));
isRebind = true;
}
pivotGridRendered: function(evt, ui) {
if(isRebind){
isRebind = false;
$(expanded).each(function(){
$("#pivotGrid").igPivotGrid("expandTupleMember", this.axisName, this.tupleIndex, this.memberIndex, true);
});
This will ensure the method is called only when needed.
Modified sample is attached for your reference. Let me know if you have any questions.
Hi Maya,
When I load the dataSourse it's works fine, then I save state and apparently it works ok, but when I click load state I receive this error message:
...velSortDirections=a;return a}else{return this._appliedLevelSortDirections}},_app...