Different column visible based on the type of the data

hi @artamonov, related to this topic. I have a follow up question.
I was able to control my columns visible programmatically using the collapsed attribute u mentioned above.

However, i have a situation where I need to have different column visible based on the type of the data. Example like this:

Type 1:
Col1 Col2 Col3

Type 2:
Col2 Col3

Type 3:
Col1 Col2

And the problem came up when I was switching back and forth around those types. I believe somewhere in the UI session we store the column visible as a user profile (just like user’s favorite view of data). Because of this, if I have multiple record with different types then the table view just remembered the last view of column visible.

Hope I can get some help here. I already did some search over the forum but couldn’t find any help yet.