Hi,
In Samples for Silverlight DV, for XamPivotGrid, there is a nice sample showing how to save and load views.
How do I save the settings class (SavedPivotGridView) to the database ?
I tried to serialize it as Xml, but it does't work (classes inside are not serializable). I also tried using PersistenceManager, but it didn't store the collections' content (Rows, Columns, Filters, Measures).
Thanks,
Alex
Dear Alex,
I'm in the middle of writing an article that extends the sample in question. It will also feature saving the data in a database. It is going to be ready in a few days. I'll post the link to the article here when it is done.
I hope that is not too late for you.
All the best,
Atanas Dyulgerov
Application developer in Product Guidance
Infragistics
Thanks Atanas, I'm waiting for your updated sample
Best regards :)
Hi Atanas,
I am trying to save the sorting too in external of xml file. I try this at my end and got sucess to save the sorting. But I was unable to apply saved sorting information. I already put post on same forum with below link.
https://ko.infragistics.com/community/forums/f/retired-products-and-controls/52969/sorting-don-t-apply-at-runtime
Actually, I have figure it out. In the Fill method:
// Preseving the order for Measures
foreach(string ms in this.Measures)
{
var f = pivotGrid.DataSource.Cube.Measures.Where(p => p.Name == ms.ToString());
if(f.Count() > 0)
IMeasure meas = f.First();
IMeasureViewModel mvm = pivotGrid.DataSource.CreateMeasureViewModel(meas);
pivotGrid.DataSource.Measures.Add(mvm);
}
//rows
foreach (string st in this.RowHierarchies)
foreach (IDimension dim in pivotGrid.DataSource.Cube.Dimensions)
var rows = dim.Hierarchies.Where(r => r.UniqueName == st);
if (rows.Count() > 0)
IFilterViewModel fvm = pivotGrid.DataSource.CreateFilterViewModel(rows.First());
pivotGrid.DataSource.Rows.Add(fvm);
//columns order
foreach (string st in this.ColumnHierarchies)
var colmns = dim.Hierarchies.Where(r => r.UniqueName == st);
if (colmns.Count() > 0)
IFilterViewModel fvm = pivotGrid.DataSource.CreateFilterViewModel(colmns.First());
pivotGrid.DataSource.Columns.Add(fvm);
Regards.
I am working with PivotGrid and in my application I save / load grid layout in / from xml file in the local folder. All looks good and I am using your example to save and load. There is one issue though. If columns, rows or measures on the grid on save in the specific order, this order is not perseved on load. As an example. If columns order on save is Distance, Km Per Liter, Usage, CO2, CO2e. After load from the file the order is CO2, CO2e, Km Per Liter, Distance, Usage. The same issue for rows and measures. Is ther any way to keep the order on load? Or any grid settings can help with this?
Thank you.
Irina
Hello Atanas
I added the BackgroundWorker thread to your example class SavedPivotGridView (less work for others regarding integration) since it will not influence using a flat file source in a negative way and in addition it allows using the XMLA source.
Looking forward to your Article.
With kind regards,
Achim
Hi, Achim,
The XMLA data source works in a different way.
The browser hangs because waitOne suspends the whole thread and the pivotgrid cant expand its members (which means the event that stops the waiting never fires). If you want to use XMLA data source you need to take the expansion process in a separate thread.
I'm attaching a sample that expands filter members up to a certain level with XMLA data source. You will find all you need there.
If you cant figure out what to change in the serialization sample I'll post the modified version tomorrow.
Atanas