title: Reset column order in angularjs ui-grid after moving
body: <p>I have a ui-grid using the ui-grid-move-columns directive. With this directive, I can drag drop the ui-grid columns to change their order. I would like to be able to reset the column order back to the original state.</p>
  
  <p>Without the ui-grid-move-columns directive you can reorder the options.columnDefs to change the column order. In this case, changing the order of the options.columnDefs seems to have no immediate effect. I found that I could clear the columnDefs, and then re-populate, but this caused other issues, and also seems a bit hacky (see plunker for example <a href="http://plnkr.co/edit/JUqzefRKJgoF0VQXrffa?p=preview" rel="nofollow noreferrer">http://plnkr.co/edit/JUqzefRKJgoF0VQXrffa?p=preview</a>):</p>
  
  <pre><code>$scope.reset = function(){
    var columnDefs = $scope.gridOptions.columnDefs;
    var columnDefsBak = columnDefs.slice();
    columnDefs.length = 0;
    $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN );
    columnDefs.push.apply(columnDefs, columnDefsBak)
    $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN );
  }
  </code></pre>
  
  <p>I also tried using the ui.grid.moveColumns.moveColumn(originalPosition, finalPosition) API (<a href="http://ui-grid.info/docs/#/api/ui.grid.moveColumns.api:PublicApi" rel="nofollow noreferrer">http://ui-grid.info/docs/#/api/ui.grid.moveColumns.api:PublicApi</a>), and re-ordering everything, but for a wide table (approx 20 cols, and needing to move 19 of them) the performance in FF and IE was terrible.</p>
  
  <p>What is the best way to achieve this?</p>