From df454ef6b2edaead43298529776a61bf23349a08 Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Sat, 5 Apr 2014 10:35:33 -0400 Subject: [PATCH] Revert "Add documentation for hideSelectionFromResult" This reverts commit 916bb14414f2acc1dbb64b56fe7c9ada601fdc40. New problems found in: https://github.com/ivaynberg/select2/issues/2196 Original issue: https://github.com/ivaynberg/select2/issues/1538 Pull request: https://github.com/ivaynberg/select2/pull/2032 --- index.html | 63 ------------------------------ select2-latest.html | 93 ++++++++------------------------------------- 2 files changed, 16 insertions(+), 140 deletions(-) diff --git a/index.html b/index.html index 76bf675e..9f4f34f7 100644 --- a/index.html +++ b/index.html @@ -223,7 +223,6 @@ $("#e10_4").select2({
  • Sorting Displayed Results
  • Responsive Design
  • Diacritics Support
  • -
  • Allow duplicated tags
  • Documentation
  • @@ -1077,36 +1076,6 @@ $(document).ready(function () { -
    -
    -

    Allow duplicated tags

    -

    In multiple mode, select2 doesn't allow the same tag to be selected more than once. This default behavior can be overridden by implementing the hideSelectionFromResult function:

    -

    - -

    - -
    -

    Example Code

    -
    
    -              
    -
    -
    - - - @@ -1667,38 +1636,6 @@ $("#select").select2({

    Function can be used when the dropdown is configured in single and multi-select mode. It is triggered after selecting an item. In single mode it is also triggered after initSelection (when provided).

    - hideSelectionFromResultfunction -

    Function that determines if the selected item should be displayed or hidden from the result list.

    - - - - - -
    ParameterTypeDescription
    dataobjectSelected data.
    -

    By default, the selected item is visible in the result list in single mode and hidden in multi-select mode. - This behavior can be overridden by implementing the hideSelectionFromResult function.

    -

    For instance, in the case of a single select box it can be used to hide the selected item from the result list:

    -
    -function hideSelectedItem(selectedObject){
    -    return true;
    -}
    -
    -$("#e1").select2({
    -    hideSelectionFromResult: hideSelectedItem
    -})
    -            
    -

    More complex behavior can be achieved by reading the text of the selected item:

    -
    -function hideAlaskaFromResult(selectedObject){
    -    return selectedObject.data("select2-data").text == "Alaska" ? true : false;
    -}
    -
    -$("#e1").select2({
    -    hideSelectionFromResult: hideAlaskaFromResult
    -})
    -            
    -

    The return value of hideSelectionFromResult is a boolean. It returns undefined if it is not implemented.

    -
    diff --git a/select2-latest.html b/select2-latest.html index fc95cde4..4df1903b 100644 --- a/select2-latest.html +++ b/select2-latest.html @@ -233,7 +233,6 @@ $("#e10_4").select2({
  • Sorting Displayed Results
  • Responsive Design
  • Diacritics Support
  • -
  • Allow duplicated tags
  • Documentation
  • @@ -980,22 +979,21 @@ $("#e18,#e18_2").select2();

    Disabled options

    @@ -1043,7 +1041,6 @@ $(document).ready(function () { }); $('#e21').select2('data', preload_data ) }); -

    Lock selections

    @@ -1087,36 +1084,10 @@ $(document).ready(function () {
    -
    -
    -

    Allow duplicated tags

    -

    In multiple mode, select2 doesn't allow the same tag to be selected more than once. This default behavior can be overridden by implementing the hideSelectionFromResult function:

    -

    - -

    - -
    -

    Example Code

    -
    
    -              
    -
    -
    + - + @@ -1677,38 +1648,6 @@ $("#select").select2({

    Function can be used when the dropdown is configured in single and multi-select mode. It is triggered after selecting an item. In single mode it is also triggered after initSelection (when provided).

    - hideSelectionFromResultfunction -

    Function that determines if the selected item should be displayed or hidden from the result list.

    - - - - - -
    ParameterTypeDescription
    dataobjectSelected data.
    -

    By default, the selected item is visible in the result list in single mode and hidden in multi-select mode. - This behavior can be overridden by implementing the hideSelectionFromResult function.

    -

    For instance, in the case of a single select box it can be used to hide the selected item from the result list:

    -
    -function hideSelectedItem(selectedObject){
    -    return true;
    -}
    -
    -$("#e1").select2({
    -    hideSelectionFromResult: hideSelectedItem
    -})
    -            
    -

    More complex behavior can be achieved by reading the text of the selected item:

    -
    -function hideAlaskaFromResult(selectedObject){
    -    return selectedObject.data("select2-data").text == "Alaska" ? true : false;
    -}
    -
    -$("#e1").select2({
    -    hideSelectionFromResult: hideAlaskaFromResult
    -})
    -            
    -

    The return value of hideSelectionFromResult is a boolean. It returns undefined if it is not implemented.

    -