Thanks that works well, though I'm surprised how complicated the solution is.
I am using AngularJS, so was wondering if there was a way to change the width by applying different styles e.g. div < class="tablewidth-{{view-name}}" >
so when the view-name variable changed the corresponding style is applied to the table.