title: R shiny gvisTable with columns selected by user in defined order
body: <p>I have an <a href="http://www.rstudio.com/shiny/" rel="nofollow noreferrer">R shiny</a> webpage where I currently use <a href="http://www.inside-r.org/packages/cran/googleVis/docs/gvisTable" rel="nofollow noreferrer"><code>gvisTable</code></a> to show a selection of columns from a data.frame. The rows are dynamically selected by the user with the <code>sidebarPanel</code>, but right now the columns are hard-coded inside the <code>gvisTable</code> call.</p>
  
  <p>I would like to allow the user to dynamically select the columns from a drop-down menu (see snapshot of a similar system from a non-shiny webpage). The key feature I want is to allow resorting of the columns.</p>
  
  <p><img src="https://i.stack.imgur.com/sE8Kn.png" alt="enter image description here"></p>
  
  <p>Any ideas how to pass this sorted selection of columns in shiny?</p>
  
  <p>I don't mind using something else instead of <code>gvisTable</code> if it does the job.</p>
  
  <p>EDIT: Thanks for showing a solution using the sortable answer. It works both for my old and new versions of shiny. Yet, this does not seem to remember the order upon hitting "Refresh", which would be really nice to have.</p>
  
  <p>So, can it save the last chosen order as a browser cookie or a similar way? The server is authenticated, and I've been told I could put the variable order in a list with the user id as the key. An example of that would be great.</p>