Hello!
I am having an issue that I can't explain and I hope you can.
I have hard coded a default layout for all users. When a user closes a form that a grid is on, the current grid layout is stored in the database and loaded the next time the users opens the form. I give the users the option (via a menu option) to reload the default layout. I do this by deleting record for the users layout, then call resetcolumns on each band in the grid (most grids only have one band) and then call the code to set the default layout.The code to reset the default layout has a call to the load from database routine but since no record exists is sets the default layout (column visibleposition, hidden and ExcludeFromColumnChooser properties). This works great (thanks to all who posted with this code).
We are changing the code to allow administrative users the ability to save a default layout for all users. I have added code to check to see if the user has a layout saved, if not, it tries to load the default saved by the administrator. This works great when the user does not have a saved layout and the form is loaded for the first time. The admins default layout loads without issue.
Here is my problem, when the user has a saved layout and they choose to reset the layout, I run through the code to reset to the saved default layout (delete the users layout, resetcolumns, load default from database). It does not appear that the load from the database happened at all. All columns are visible and in the order of the data.
Hello wlappin,
Please re-check which layout you are loading exactly and the order of resetting and loading the new layout. If the order is messed up, this could cause such issue. You should be sure about this. If however, you are sure that this is not the issue here I will ask you to try to attach if possible a small sample project reproducing this, I will be happy to take a look at it.
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.