title: Why the gridApi.on.edit.beginCellEdit in angular-ui-grid cannot update the new drop-down options immeidiately?
body: <p>I have the same problem with this one <a href="https://stackoverflow.com/questions/36714215/why-ui-grid-value-drop-down-box-will-be-assigned-in-the-event-fires-before-begin.">Why ui grid value drop-down box will be assigned in the event fires before beginCellEdit in angular</a>
  And have little bit difference. After I updated the editDropdownOptionArray it still keep the old value, It's only have the new value in the next click.</p>
  
  <p>Hope everyone can help me with this one.
  Thank you.</p>
  
  <p>Here is my code snippet:</p>
  
  <p>The html of the dropdown:</p>
  
  <pre><code>&lt;div&gt;
      &lt;form name="inputForm"&gt;
          &lt;select ng-class="'colt' + col.uid"
                  ui-grid-edit-dropdown
                  ng-model="MODEL_COL_FIELD"
                  ng-options="field CUSTOM_FILTERS for field in editDropdownOptionsArray"&gt;&lt;/select&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The controller code:</p>
  
  <pre><code>$scope.menuColumns = [
                          { displayName: 'Menu', field: 'name', enableCellEdit: false },
                          {
                              displayName: 'Access Level', field: 'accessLevelName',
                              editableCellTemplate: 'Scripts/application/role/directive/dropdown-menu-assignment.html',
                              editDropdownValueLabel: 'Access Level', editDropdownOptionsArray: userMgtConstant.menuAccessLevel
                          }
                      ];
  
                      $scope.menuOptions = {
                          data: [],
                          onRegisterApi: function (gridApi) {
                              gridApi.edit.on.beginCellEdit($scope, function (rowEntity, colDef, event) {
                                  if (rowEntity.parent === true) {
                                      colDef.editDropdownOptionsArray = $scope.levelList;
                                  } else {
                                      colDef.editDropdownOptionsArray = $scope.childLevelList;
                                  }
                              });
                              gridApi.edit.on.afterCellEdit($scope, function (rowEntity, colDef, newValue, oldValue) {
                                  if (rowEntity.parent !== true) {
                                      if(rowEntity.name === 'Revenue Bench'){
                                          var accessLevel = commonUtils.getIdFromName(rowEntity.accessLevelName, userMgtConstant.menuAccessLevel);
                                          if(accessLevel &gt; 1){
                                              $scope.isShowFunctionAssignment = false;
                                          } else if(rowEntity.functionAssignments.length !== 0) {
                                              $scope.isShowFunctionAssignment = true;
                                          }
                                      }
                                  } else {
                                      // udpate child dropdown list menu
                                      var index = _(userMgtConstant.menuAccessLevel).indexOf(newValue);
                                      $scope.childLevelList = $scope.levelList.filter(function (item, i) {
                                          return i &gt;= index;
                                      });
  
                                      if($scope.childLevelList.length &gt; 2){
                                          parentSwitch = true;
                                      }
  
                                      if($scope.childLevelList.length &lt; 3 &amp;&amp; parentSwitch){
                                          colDef.editDropdownOptionsArray = $scope.childLevelList;
                                          parentSwitch = false;
                                      }
  
                                      // update all child value
                                      _($scope.menuOptions.data).each(function (dataItem) {
                                          if (dataItem.parent !== true) { // prevent infinite loop
                                              dataItem.accessLevelName = newValue;
                                          }
                                      });
                                  }
                              });
                          }
                      };
  </code></pre>
  
  <p>Here is the usage of the grid:</p>
  
  <pre><code>&lt;inline-edit-grid options="menuOptions" columns="menuColumns"&gt;&lt;/inline-edit-grid&gt;
  </code></pre>