Просмотр исходного кода

Graph: series override dropdown menu select did not work after recent commit that added typeahead to this dropdown

Torkel Ödegaard 11 лет назад
Родитель
Сommit
b85fe62389
2 измененных файлов с 12 добавлено и 1 удалено
  1. 11 0
      src/app/directives/dropdown.typeahead.js
  2. 1 1
      src/app/panels/graph/seriesOverridesCtrl.js

+ 11 - 0
src/app/directives/dropdown.typeahead.js

@@ -37,6 +37,17 @@ function (angular, app, _, $) {
             return memo;
             return memo;
           }, []);
           }, []);
 
 
+          $scope.menuItemSelected = function(optionIndex, valueIndex) {
+            var option = $scope.menuItems[optionIndex];
+            var result = {
+              $item: option.submenu[valueIndex],
+              $optionIndex: optionIndex,
+              $valueIndex: valueIndex
+            };
+
+            $scope.dropdownTypeaheadOnSelect(result);
+          };
+
           $input.attr('data-provide', 'typeahead');
           $input.attr('data-provide', 'typeahead');
           $input.typeahead({
           $input.typeahead({
             source: typeaheadValues,
             source: typeaheadValues,

+ 1 - 1
src/app/panels/graph/seriesOverridesCtrl.js

@@ -23,7 +23,7 @@ define([
       option.submenu = _.map(values, function(value, index) {
       option.submenu = _.map(values, function(value, index) {
         return {
         return {
           text: String(value),
           text: String(value),
-          click: 'setOverride(' + option.index + ',' + index + ')'
+          click: 'menuItemSelected(' + option.index + ',' + index + ')'
         };
         };
       });
       });