We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Deserialize is not loading unchecked filtered items

I'm using SerializedXmlString and DeserializeXmlString to save PivotGridControl config. But when I restore it with DeserializeXmlString and click in the filter icon, I just see the options that were selected previous to serialization. (In this sample, 2002, 2004 and 2006) but the rest of the years are not listed.
I can see that in the XML the FilterItems (see xml attached).
Does it have to do with the order in which I assign ItemsSource? What should I do first: changing itemsource or deserializing settings?

dg.ItemSource = model.ItemSourceCache[symbolName];
dg.DeserializeXmlString(pivotConfig);

or

dg.DeserializeXmlString(pivotConfig);
dg.ItemSource = model.ItemSourceCache[symbolName];

Thanks in advance!

Attachment: pivotConfig_1f5eb38a.zip

9 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team March 1, 2019 06:55 AM UTC

Hi Carlos, 
 
Thanks for contacting Syncfusion support. 
 
We have analyzed the query –“Deserialize is not loading unchecked filtered items” in your reported version 16.4.0.42. Please understood that, SerializeXmlString method is used to store the current state of pivot grid control. It includes the PivotRows, PivotColumn, PivotCalcualtions, Filters and all other pivot grid property values. Suppose if you are doing any filtering operation(like Dim3 = 2002 || Dim3 = 2004 || Dim3 = 2006) the selected values are maintained in the Filters property. While invoking the DeserializeXmlString method, the saved state of filter to be maintained in the pivot grid control. While loading the control, the selected values are maintained in the filter popup(checked state) correctly, remaining fields are unchecked state. No need to assign the ItemSource value to the pivot grid while invoking the DeserializeXmlString method. 
 
Please refer our ug documentation from the following link: 
 
Refer the attached videos and our working sample from the following location: 
 
If the above information does not meet your actual requirement, could you please share the detailed description about your requirement, so that it could be helpful to provide the solution at the earliest. 
 
Regards, 
Jagadeesan 



CF Carlos Fernando Consigli March 1, 2019 02:45 PM UTC

Ok, there is some specific combination of steps that makes it fail. I followed your steps exactly and worked ok, but I'm attaching a video running your sample with no modifications and following a different combination of steps and you can see how it fails. (Sorry for the bad quality, I had to take it with my phone because the Windows Recorder for some reason didn't capture the Filters popup). Try to follow the exact steps in the attached video and see if you can reproduce the issue.

Regarding ItemsSource, I must reassign it because I'm actually changing the source of data on runtime, and I'm getting different errors whether if I assign ItemsSource before or after loading config on the pivot grid.

Attachment: PivotSample2_54922eea.zip


AA Arulraj A Syncfusion Team March 4, 2019 10:42 AM UTC

Hi Carlos, 

Thanks for the update. 

Query 
Response 
there is some specific combination of steps that makes it fail. I followed your steps exactly and worked ok, but I'm attaching a video running your sample with no modifications and following a different combination of steps and you can see how it fails. 
Sorry for the inconvenience caused. 

We are able to reproduce the reported issue “Unchecked filter items are removed from filter popup after deserialize the pivot grid control”. We will provide the patch file for the reported issue on 18th March, 2019 in your version 16.4.0.42. 


We appreciate your patience until then.  
Regarding ItemsSource, I must reassign it because I'm actually changing the source of data on runtime, and I'm getting different errors whether if I assign ItemsSource before or after loading config on the pivot grid. 
We have prepared a sample based on your requirement – “To change the ItemSource value dynamically at runtime”. You should define the ItemSource value before initialize the pivot fields. 


If the above solution does not meet your actual requirement, could you please share the detailed description about your requirement so that it could be helpful to provide the solution at the earliest. 

Please let us know if you need any further assistance. 

Arulraj A 



CF Carlos Fernando Consigli March 5, 2019 01:06 AM UTC

Excellent, you're awesome. And I have to report another issue that have just found and that MAY be related to this one.

In the same example, just add ShowGrandTotals="False" to the pivot control and follow this steps (I attach a video and the code)
1) Move one of the two PivotRows to the columns section and leave only one PivotRow
2) Click Serialize
3) (optional) change something on the layout
4) Click Deserialize

Expected:
Grid should get back to the state it was on step 2)

What happens:
Grid returns to state on step 2 but without the PivotRow

This doesn't seem to happen when ShowGrandTotals is true.

Thanks again for all your support. 



Attachment: Sample_MissingPivotRow_3338f9ad.zip


CF Carlos Fernando Consigli March 5, 2019 01:08 AM UTC

Sorry, I missed the video, I didn't realize it was just one attachment per comment. Here it goes.

Attachment: Serialization__4_3_2019_21_57_48_274be64b.zip


TB Thirupathi Bala Krishnan Syncfusion Team March 5, 2019 12:56 PM UTC

Hi Carlos,  
 
We are able to reproduce the reported issue “Pivot row items are not maintained properly after de-serializing the report”. We will provide the patch file for the reported issue on 18th March, 2019 in your version 16.4.0.42.  
 
 
We appreciate your patience until then.   
 
Regards, 
Thirupathi B. 



CF Carlos Fernando Consigli March 5, 2019 10:04 PM UTC

Thanks. As I have already said before, I have never seen such good support as in Syncfusion.
And I'm sorry to bother again with something that is probably related to the previous issues. I'm working in an app that mainly uses the PivotControl and that's why I'm "splitting hairs" with this.

The issue is this: when you have a PivotSchemaDesigner linked to the PivotControl and you change the ItemSource, the PivotSchemaDesigner is ignoring FieldCaptions. So in the Pivot Table Field list you see, incorrectly, the Field Mapping names while in Column and Row Labels you see the correctly the FieldCaptions.
And if you drag a field to a group where it is already added (for example to Row Label) it works ok and it doesn't add it again. BUT if you drag it to another area (Column Labels), instead of moving it from Row Labels, it adds it again.
I'm attaching a sample based on the one you made to help me with this ItemSource changing. I only added FieldCaption to all PivotRows, PivotColumns and PivotCalculations. In the zip there is also a video showing what I tried to explain above.


Also, I'm trying to hide some properties from the BusinessObject in the field list (in this sample, I added a "UnrelatedProperty" property). I read on documentation that you can use  ShowDisplayFieldsOnly but that way, as soon I uncheck one of the fields included in the pivot grid, it dissapears and I cannot add it again using the PivotSchemaDesigner. Is there a way to prevent "UnrelatedProperty" from appearing in the field list without using ShowDisplayFieldsOnly ?

Thanks in advance



Attachment: PivotGridFieldCaptions_154d6e0e.zip


AA Arulraj A Syncfusion Team March 6, 2019 11:52 AM UTC

Hi Carlos, 

Thanks for your valuable feedback. 

Query 
Response 
The issue is this: when you have a PivotSchemaDesigner linked to the PivotControl and you change the ItemSource, the PivotSchemaDesigner is ignoring FieldCaptions. So in the Pivot Table Field list you see, incorrectly, the Field Mapping names while in Column and Row Labels you see the correctly the FieldCaptions. 
As per the default behavior, the fields are added into the PivotTableFieldList based on the itemProperties used in the application. You can resolve this issue by invoking the InitializePivotTableList method which is available in PivotSchemaDesigner class and also clear the fields from the PivotFields property. 

Please refer the following code sample. 

#RadioButttonClickAction.cs 
 
        private void LoadList() 
        { 
            this.Target.ItemSource = null; 
            this.Target.ResetPivotData(); 
            this.Target.ItemSource = BusinessObjectCollection.GetList(200); 
 
            this.Target.PivotRows.Add(new PivotItem() { FieldMappingName = "Fruit", FieldCaption ="Fruta_2", FieldHeader = "Fruit", TotalHeader = "Total" }); 
 
            this.Target.PivotColumns.Add(new PivotItem() { FieldMappingName = "Shape", FieldCaption = "Shape_2", FieldHeader = "Shape", TotalHeader = "Total" }); 
 
            this.Target.PivotCalculations.Add(new PivotComputationInfo() { FieldName = "Count", FieldCaption = "Count_2", FieldHeader = "Count", SummaryType = SummaryType.DoubleTotalSum }); 
 
            PivotSchemaDesigner schemaDesigner = (PivotSchemaDesigner)(this.Target as PivotGridControl).GetType().GetProperty("SchemaDesigner", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this.Target, null); 
 
            if (schemaDesigner != null) 
            { 
                this.Target.PivotFields.Clear(); 
                schemaDesigner.InitializePivotTableList(); 
            } 
        }  

Is there a way to prevent "UnrelatedProperty" from appearing in the field list without using ShowDisplayFieldsOnly ? 
No. We don’t have any option to prevent the property alone while initializing the control. 

As per default behavior of ShowDisplayFieldsOnly, it must display the fields which is available in Rows, Columns, Values and Filter section of SchemaDesigner. Rest of the fields are removed from the PivotTableFieldList. Same behavior will be followed if you are removing any field at runtime, the field will be removed from field list automatically. 

If you want to prevent "UnrelatedProperty" from appearing in the field list, you can remove the property definition from the BusinessObject class. 


Please let us know if you need any further assistance. 

Regards, 
Arulraj A 



AA Arulraj A Syncfusion Team March 20, 2019 06:35 AM UTC

 
Thanks for your patience. 
 
We have fixed the below reported issues, 
  1. Unchecked filter items are removed from filter popup after deserialize the pivot grid control
  2. Pivot row items are not maintained properly after de-serializing the report
  
Please find the patch file from the following location:    
    
V16.4.0.42 
Recommended approach – exe will perform automatic configuration         
Please find the patch setup here:                               
     
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                          
Please find the patch assemblies alone from:          
     
Please find the Nugets from the below location:         
      
         
NOTE
You can change how you receive bug fixes by navigating to the following link and updating your preferences.
https://www.syncfusion.com/support/directtrac/patches      
       
Disclaimer:                        
Please note that we have created this patch for the version 16.4.0.42 specifically to resolve the issues reported in this forum #143019. If you have received other patches for the same version for other products, please apply all patches in the order received. This fix will be included in our 2019 Volume 1 main release which will be available in the end of March 2019. 
 
Regards, 
Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon