title: angularjs UI grid - assign columns and data dynamically
body: <p>I am trying to add columns dynamically to the <code>ui-grid</code> and also assigning the data. First time, the grid is working good. But, when i try to change the columns and data dynamically, it is not working as expected. </p>
  
  <pre><code>$scope.myfunc = function() {
  
  alert("Rebinding the data");
  $scope.gridOptions = {};
  
  $scope.gridOptions.columnDefs.push({
   name: 'firstName'
    });
    $scope.gridOptions.columnDefs.push({
   name: 'lastName'
    });
    $scope.gridOptions.columnDefs.push({
   name: 'company'
    });
    $scope.gridOptions.columnDefs.push({
   name: 'employed'
    });
  
    alert("added new columns");
    $scope.gridOptions.data = data1;
  
    $scope.gridApi.grid.refresh();
  };
  </code></pre>
  
  <p>please check the <a href="http://plnkr.co/edit/qtStgClN8heQAc6MI6yG?p=preview" rel="nofollow">plunkr</a></p>
  
  <p>Can anybody look into this issue and suggest me how to do this?</p>