Ticket T1203430
Visible to All Users

PivotGrid for WinForms - Filter is not set after RestoreLayout

created a year ago

Hi,

similar problem in DX version 22.2.4.

  1. If I restore pivot layout, filter is here.
  2. After reload filter disappears.
  3. After another reload filter is there.
  4. After another reload filter disappears.

And so on and on…

Set ActiveFilterString to empty string fix the problem:

C#
pivotGridControl1.ActiveFilterString = String.Empty; pivotGridControl1.RestoreLayoutFromXml(xmlFilePath);

Solution from this ticket:
PivotControl Filter is not set after RestoreLayout

In my case it was old DevExpress.XtraPivotGrid.v17.2 layout.

Regards,
Peter.

Answers approved by DevExpress Support

created a year ago

Hi,

Yes, the solution is to reset the ActiveFilterString option because it has a higher priority than the old PreFilter option. Please let me know if you need further clarification.

Regards,
Alessandro

    Show previous comments (18)
    Alessandro (DevExpress Support) a year ago

      You can also try this version, but I am not sure that it will work. The most reliable solution according to our research is to re-save layouts in v22.1.5.

        Ok, and what about write single utility in v22.1.5, to fix layout? No need to downgrade application, only connect to database and re-save layouts?

        Something like this:

        C#
        PivotGridControl pivot; System.IO.Stream str; var opt = new DevExpress.Utils.OptionsLayoutGrid(); opt.StoreAllOptions = true; opt.Columns.StoreAllOptions = true; var dt = GetDataFromDb(); foreach(DataRow dr in dt.Rows) { pivot = new PivotGridControl(); pivot.ActiveFilterString = String.Empty; pivot.RestoreLayoutFromStream(new System.IO.MemoryStream(dr["layout"]), opt); str = new MemoryStream(); pivot.SaveLayoutToStream(str, opt); dr["layout"] = str.ToArray(); } SaveDataToDb(dt);

        This should work, isn't it? Any negative affect to layouts v22.2.4 re-saved in v22.1.5?

        Alessandro (DevExpress Support) a year ago

          Hi,

          You can initially save layouts to files (XML) to ensure that the save procedure replaces the old PreFilter option with the new ActiveFilterString option. Then, everything should work in all newer versions.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.