Hi all,
I use successfully the option to fixe and unfixe the columns headers of a grid.
But i'm stuck with a little problem, and I can't find the answer to it.
If I have 5 columns (the first two fixed) in a grid like this Column1 Column2 | Column3 Column4 Column5
and then try to fixed the Column4 it stays like this Column1 Column2 Column4 | Column3 Column5
so far so good, but if I unfixe the Column4 it stays like this Column1 Column2 | Column4 Column3 Column5
Is there any way to put the Column4 back to it's original place?
Thank you
Hugo
Hi Alan,
Thank you for the reply.
I'm building a grid to enter forecasts for 12 months, and my users asked me if they cold pin some columns. When they unpin I wanted the column to go back to the original place so the logical order could be maintained.
Anyway, I used your suggestion and after some struggle I was able to put the columns back to their original place.
Once again thank you
Hugo,
The grid doesn't track where the columns were before they were fixed because it is also possible that users could make other changes between when they are fixed and unfixed. For example, if the user moves Column5 to be before Column3 between when Column4 is fixed and unfixed, how would the grid determine where to put Column4. There are three possibilities in this case:
These three possibilities are the result of moving just one column between fixing and unfixing a column and this can become much more complex as you add more columns where end users could make more modifications. This is why when the column is fixed it is treated as if it was moved and when unfixed it will always become the left most column that can be scrolled.
If you do have a set order of columns that you always know, you can use the Before/AfterColPosChanged events to set the order manually of the columns that are not pinned. You can do this by setting the VisiblePosition of the Header of each column to be the position you need the columns to be in.
Let me know if you have any questions with this matter.