diff --git a/pages/javascripts/pages/home/home.html b/pages/javascripts/pages/home/home.html index cfcf370d..6d306a8a 100644 --- a/pages/javascripts/pages/home/home.html +++ b/pages/javascripts/pages/home/home.html @@ -801,6 +801,12 @@

Settings

angular.noop Related the "Smart Button Text" feature, if a function provided - it will called with two paramters: The item's text and the original item, the return value will displayed instead of the item's display property. This feature is useful when you want to convert the displayed text into something else. + + allowSelectionProp + String + undefined + Name of the property that should be used to determine it should allow user to select the option or not +

Events

diff --git a/src/angularjs-dropdown-multiselect.js b/src/angularjs-dropdown-multiselect.js index 81f611b4..4ee61f58 100644 --- a/src/angularjs-dropdown-multiselect.js +++ b/src/angularjs-dropdown-multiselect.js @@ -36,10 +36,10 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co template += '
  • '; } - template += ''; + template += ''; if (checkboxes) { - template += '
    '; + template += '
    '; } else { template += ' {{getPropertyForObject(option, settings.displayProp)}}'; } @@ -93,7 +93,8 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co groupBy: $attrs.groupBy || undefined, groupByTextProvider: null, smartButtonMaxItems: 0, - smartButtonTextConverter: angular.noop + smartButtonTextConverter: angular.noop, + allowSelectionProp: undefined }; $scope.texts = { @@ -257,6 +258,11 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co finalObj = findObj; } + if($scope.settings.allowSelectionProp && getPropertyForObject(_.find($scope.options, findObj), $scope.settings.allowSelectionProp) === false) { + //Disabled option + return; + } + if ($scope.singleSelection) { clearObject($scope.selectedModel); angular.extend($scope.selectedModel, finalObj);