From a728044fa9b8eb5281ff9535bbb91932656b296b Mon Sep 17 00:00:00 2001 From: Florian Kissling Date: Mon, 4 May 2015 03:04:09 +0200 Subject: [PATCH] More grouping on the "Examples" page. * "Loading array data" and "Loading remote data" now go together under "Other data sources", * "Events" and "Programmatic access" under "Programmatic control", * "Theme support", "Responsive design" and "Templating" under "Themes, templating and responsive design" --- docs/_includes/nav/examples.html | 54 ++-- docs/examples.html | 436 ++++++++++++++++--------------- 2 files changed, 266 insertions(+), 224 deletions(-) diff --git a/docs/_includes/nav/examples.html b/docs/_includes/nav/examples.html index c7bef5ad..5a1902ae 100644 --- a/docs/_includes/nav/examples.html +++ b/docs/_includes/nav/examples.html @@ -10,16 +10,17 @@ Placeholders
  • - Templating -
  • -
  • - Loading array data -
  • -
  • - Loading remote data -
  • -
  • - Responsive design + + Other data sources + +
  • Disabled mode @@ -27,9 +28,6 @@
  • Disabled results
  • -
  • - Programmatic access -
  • Limiting the number of selections
  • @@ -37,7 +35,15 @@ Hiding the search box
  • - Events + Programmatic control +
  • Tagging support @@ -48,9 +54,6 @@
  • Custom matcher
  • -
  • - Theme support -
  • Localization, RTL and diacritics support +
  • +
  • + + Themes, templating and responsive design + + +
  • Back to top diff --git a/docs/examples.html b/docs/examples.html index aa51b0f8..a2bc91da 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -91,6 +91,7 @@ $(".js-example-basic-multiple").select2();
    +

    Placeholders

    @@ -125,49 +126,15 @@ $(".js-example-placeholder-multiple").select2({ placeholder: "Select a state" }); +

    -

    Templating

    -

    - Various display options of the Select2 component can be changed: - You can access the <option> element - (or <optgroup>) and any attributes on those elements - using .element. -

    +

    + Other data sources +

    -

    - Templating is primarily controlled by the - templateResult - and templateSelection - options. -

    - -
    -

    - -

    -
    - -
    
    -
    -
    -      
    - -

    Loading array data

    @@ -208,10 +175,8 @@ $(".js-example-data-array-selected").select2({ -

    -
    -

    Loading remote data

    +

    Loading remote data

    Select2 comes with AJAX support built in, using jQuery's AJAX methods. @@ -283,43 +248,11 @@ $(".js-data-example-ajax").select2({ +

    -

    Responsive design - Percent width

    -

    - Select2's width can be set to a percentage of its parent to support - responsive design. The two Select2 boxes below are styled to 50% and 75% - width respectively. -

    - -
    -

    - -

    - -

    - -

    -
    - -
    
    -
    -        
    - Select2 will do its best to resolve the percent width specified via a - css class, but it is not always possible. The best way to ensure that - Select2 is using a percent based width is to inline the - style declaration into the tag. -
    - - -
    - -

    Disabled mode

    @@ -362,6 +295,7 @@ $(".js-programmatic-disable").on("click", function () { $(".js-example-disabled-multi").prop("disabled", true); }); +

    @@ -395,78 +329,6 @@ $(".js-programmatic-disable").on("click", function () {
    -
    -

    Programmatic access

    - -

    - Select2 supports methods that allow programmatic control of the - component. -

    - -
    -

    - -

    - - - -

    - -

    - -
    - - -
    - -
    - -
    
    -
    -
    -
    -      
    -

    @@ -497,6 +359,7 @@ $(".js-example-basic-multiple-limit").select2({

    +

    Hiding the search box

    @@ -522,7 +385,12 @@ $(".js-example-basic-hide-search").select2({

    -

    Events

    + +

    + Programmatic control +

    + +

    Events

    Select2 will trigger some events on the original select element, @@ -601,9 +469,80 @@ function log (name, evt) { }); } + +

    Programmatic access

    + +

    + Select2 supports methods that allow programmatic control of the + component. +

    + +
    +

    + +

    + + + +

    + +

    + +
    + + +
    + +
    + +
    
    +
    +
    +
           
    +

    Tagging support

    @@ -637,6 +576,7 @@ $(".js-example-tags").select2({

    +

    Automatic tokenization

    @@ -673,6 +613,7 @@ $(".js-example-tokenizer").select2({

    +

    Custom matcher

    @@ -716,7 +657,108 @@ $.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) {

    -

    Theme support

    + + +
    + +
    + +

    + Localization, RTL and diacritics support +

    + +

    Multiple languages

    + +

    + Select2 supports displaying the messages in different languages, as well + as providing your own + custom messages + that can be displayed. +

    + +

    + The language does not have to be defined when Select2 is being + initialized, but instead can be defined in the [lang] + attribute of any parent elements as [lang="es"]. +

    + +
    +

    + +

    +
    + +
    
    +
    +
    +
    +        

    RTL support

    + +

    + Select2 will work on RTL websites if the dir attribute is + set on the <select> or any parents of it. You can also + initialize Select2 with dir: "rtl" set. +

    + +
    +

    + +

    +
    + +
    
    +
    +
    +
    +        

    Diacritics support

    + +

    + Select2's default matcher will ignore diacritics, making it easier for + users to filter results in international selects. Type "aero" into the + select below. +

    + +
    +

    + +

    +
    + +
    
    +
    +
    +
    +      
    + +
    + +

    + Themes, templating and responsive design +

    + +

    Theme support

    Select2 supports custom themes using the @@ -752,94 +794,74 @@ $(".js-example-theme-multiple").select2({ }); -

    - -
    -

    - Localization, RTL and diacritics support -

    - -

    Multiple languages

    +

    Templating

    - Select2 supports displaying the messages in different languages, as well - as providing your own - custom messages - that can be displayed. + Various display options of the Select2 component can be changed: + You can access the <option> element + (or <optgroup>) and any attributes on those elements + using .element.

    - The language does not have to be defined when Select2 is being - initialized, but instead can be defined in the [lang] - attribute of any parent elements as [lang="es"]. + Templating is primarily controlled by the + templateResult + and templateSelection + options.

    - +

    -
    
    +        
    
     
    -
     
    -        

    RTL support

    +

    Responsive design - Percent width

    - Select2 will work on RTL websites if the dir attribute is - set on the <select> or any parents of it. You can also - initialize Select2 with dir: "rtl" set. + Select2's width can be set to a percentage of its parent to support + responsive design. The two Select2 boxes below are styled to 50% and 75% + width respectively.

    - +

    -
    -
    
    -
    -
    -
    -        

    Diacritics support

    - -

    - Select2's default matcher will ignore diacritics, making it easier for - users to filter results in international selects. Type "aero" into the - select below. -

    - -

    - +

    -
    
    +        
    
     
    -