You can configure the Pivot Table to allow end users to change the layout.
On the Table Layout tab of the Pivot Table edit view, to allow end users to change the layout, check the Enable Pivot Table configuration by end users check box.
Scripting on this page enhances content navigation, but does not change the content in any way.