We are building a new table wherein it allows the user to freeze any columns in the table. The problem now we are facing is what if user freezes the 4th column in the table should the 1st, 2nd & 3rd column in the table be frozen or should the position of the 4th column be shifted to position 1? Or any other solution to this problem?
If the functionality is meant for the user to be able to compare the content of different columns or to get context to other columns the frozen column should be displayed on position 1. Otherwise it would not be possible to get the context between columen 2 and let's say 6 if 6 should be used as contextcolumn (frozen column).
What I am not sure about is how to make the transition when the freezing action is performed. It is important that the user understands, that the column is repositioned with this action. You could name the action something like "pin column to 1 position in table". This way the user will expect that the order will be changed by this action. Another solution that jumps to my mind is displaying a "freeze placholder column" and allow the user to drag the desired column to this "freeze" column.
This seems very similar to a "pin to top" kind of functionality where the desired item gets moved from its natural-order position and instead gets locked in a certain place.
For example, when a Twitter user pins a Tweet on their profile, that Tweet gets moved from it's chronological position and appears at the top, not duplicated.
In the same manner, it seems intuitive to allow this freeze functionality to move the item to the frozen region. Upon unfreezing, the item would then return to its previous position in the table.
If multiple columns can be frozen, the ability to adjust their frozen order could likely be useful.
Once a column is frozen, it gets appended to the list of frozen columns currently in the table. Unfreezing it will make it back to its place, as shown in this Grid frozen columns demo.