Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Problem with a saved DisplayLayout when new columns are added.
posted

I have a UltraGrid on my form.  When it is first popluted, code sets the values of the DisplayLayout.  I then save the displaylayout in a file as the original. I will then check to see if there is a second file with the users saved displaylayout and load that.  This will set the display layout to the same settings the last time the user closed this form.  A user can then resize columns,  reorder and sort etc.

If the user right clicks on the grid a context menu will reset the display layout using the original saved displaylayout and also save this layout as the user defined layout.  When the user closes the form the orignal layout file is deleted and the user defined layout file is saved.

Here's my problem.  We are about to release a new version of our software and there are some new columns added to collection that is bound to the grid.  The first time the user opens this form in the new release it will again save the original display layout (New fields are hidden) and then load the existing displaylayout file.  However the new columns that were added in the collection are also shown because they are not part of the display layout and they are visible by default. In our case we don't want these fields to be visible. The user will have to right click and reset the layout in order hide these fields as we intended. (These new fields have sensitive information)

I tried a few different approches. I looped through the columns and set hidden = true. Then set the display layout.  No luck. I then hid all the columns again and tried the displaylayout.CopyFrom method. No luck.

Here are some questions.

1. What would be the best approach to handle this.
2. If we had removed a column from the collection would this blow up.
3. I saved and loaded the DiplayLayout without specifiying PropertyCategories.(What is the default)  What should I have done there.

Thanks in advance.

Dan

 

 

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi Dan,

    digitaldan3 said:
    1. What would be the best approach to handle this.

    I'm assuming here that these new columns are columns that the users should never see.

    What I would do is load the user's layout into an UltraGridLayout variable instead of directly into the grid. Then you can hide the columns within the Layout before applying it to the grid.

    Or, you could just load the layout into the grid and THEN hide the columns.

    Still another option would be to handle the InitializeLayout event of the grid and hide the columns there.

    digitaldan3 said:
    2. If we had removed a column from the collection would this blow up.

    No, it certainly shouldn't blow up.

    digitaldan3 said:
    3. I saved and loaded the DiplayLayout without specifiying PropertyCategories.(What is the default)  What should I have done there.

    The default is to save everything.

     

Children