I have a list view in which I need to dynamically hide columns based on which user is logged in through Javascript and JQuery. I am able to do this for any lists that is in the default All Items view using custom logic and $('th:nth-child('+index+'),td:nth-child('+index+')').hide();
However, this doesn't work on any list view with grouping. I've found that the view must be expanded on load in order for it to work as the data in the cells is not rendered if they are collapsed. Unfortunately, defaulting every view with groups to expanded on open is not a viable option. My questions is, is there any way for me to dynamically check what the default setting is on the list view, load the view with the groups expanded, run my script, and then revert the list to whatever the default setting was for that particular view?
Thanks for the help in advance.