diff --git a/doc/views/configs-options.htm b/doc/views/configs-options.htm index 73b38a7..4cc3d41 100644 --- a/doc/views/configs-options.htm +++ b/doc/views/configs-options.htm @@ -16,6 +16,8 @@
Full spec
orientation="horizontal | vertical" selection-mode="multiple | single" max-labels="999" + show-counter="true | false" + more-text="string" directive-id="..." is-disabled="true | false" helper-elements="all none reset filter" @@ -177,7 +179,26 @@
max-labels
  • max-labels="1" will display: "Bruce Wayne, ... (2)" on the button.
  • max-labels="0" will display: "(2)" on the button.
  • - + +
    show-counter
    +

    + To show the counter in the dropdown button if there are more items than allowed by max-labels. +

    +

    + Type: Boolean-parseable string ("true" or "false")
    + Default value: "true"
    +

    + +
    more-text
    +

    + Text to show after the items in the dropdown button if there are + more items than allowed by max-labels. +

    +

    + Type: String
    + Default value: ", ..."
    +

    +
    is-disabled

    Will disable or enable all checkboxes except stated otherwise in "disable-property" above. diff --git a/isteven-multi-select.js b/isteven-multi-select.js index b5d3465..611cfcc 100644 --- a/isteven-multi-select.js +++ b/isteven-multi-select.js @@ -61,12 +61,13 @@ angular.module( 'isteven-multi-select', ['ng'] ).directive( 'istevenMultiSelect' translation : '=' }, - /* + /* * The rest are attributes. They don't need to be parsed / binded, so we can safely access them by value. * - buttonLabel, directiveId, helperElements, itemLabel, maxLabels, orientation, selectionMode, minSearchLength, - * tickProperty, disableProperty, groupProperty, searchProperty, maxHeight, outputProperties + * tickProperty, disableProperty, groupProperty, searchProperty, maxHeight, outputProperties, showCounter, + * moreText */ - + templateUrl: 'isteven-multi-select.htm', @@ -548,9 +549,17 @@ angular.module( 'isteven-multi-select', ['ng'] ).directive( 'istevenMultiSelect' if ( $scope.more === true ) { // https://github.com/isteven/angular-multi-select/pull/16 if (tempMaxLabels > 0) { - $scope.varButtonLabel += ', ... '; + if ( typeof attrs.moreText !== 'undefined' ) { + $scope.varButtonLabel += attrs.moreText; + } else { + $scope.varButtonLabel += ', ...'; + } + } + + // Default showCounter to true + if ( typeof attrs.showCounter === 'undefined' || attrs.showCounter === 'true' ) { + $scope.varButtonLabel += '(' + $scope.outputModel.length + ')'; } - $scope.varButtonLabel += '(' + $scope.outputModel.length + ')'; } } $scope.varButtonLabel = $sce.trustAsHtml( $scope.varButtonLabel + '' );