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 :)
The article I mentioned is not yet ready, but the Silverlight sample that shows how to persist the data in the PivotGrid is ready.
I am attaching a solution that demonstrates how to save and load the states:
In the third case the only thing that you need to do in order to save the states in a database is to upload the byte array called savedBinaryData with the serialized result to the database. One way to do that is to use a WCF service. More on that in the coming article.
I hope that this is helpful. If you have any questions feel free to ask me!
P.S.
The solution comes with sample data generator, FlatDataSource that uses the generator and prepares a nice sample initial view, a custom class that represents each saved view (this is majorly different than the same class from the SamplesBrowser). This last class is also the one that we serialize. In the main page we have a number of buttons that trigger the different serializations and deserializations. The GroupBox class and the contents of the Themes folder implement a helper control to make the UI a bit more useful.
The two files that will help you most are MainPage.xaml.cs and SavedPivotGridView.cs
One more thing, the sample will look for the following assemblies:
The default location for those after you install the Silverlight NetAdvantage trial package is:
C:\Program Files (x86)\Infragistics\NetAdvantage 2010.2\Silverlight DV\Bin
If you have chosen a different location you have to update the references.
Thanks a lot Atanas
Hi Achim,
The problem is solved. The issue was in the save algorithm of the sample. I'm attaching the corrected version of the SavedPivotGridView class. After you extract the file just replace it in the original solution.
Nasko
Hello Atanas,
your example code is working now. In my scenario I the member expansion hangs my browser. I am working with an XmlaDataSource together with a SSAS 2008 cube. I pin-pointed the issue to the ManualResetEvent used in the ExpandMembers method.
ManualResetEvent manualResetEvent = new ManualResetEvent(false);filterViewModel.LoadFilterMembersCompleted += (sender1, e1) => manualResetEvent.Set();...manualResetEvent.WaitOne();
When working with the XmlaDataSource the event does not seem to get fired and the browser waits forever. It would be great if you could also test with your AdventureWorks XmlaDataSource used in one of the examples. I could reproduce this behaviour using your AdventureWorks Cube.
With kind regards,
Achim
p.s. thanks for your great support!
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
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://es.infragistics.com/community/forums/f/retired-products-and-controls/52969/sorting-don-t-apply-at-runtime
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.