From fec3d3aafbd91a6b39ec0de342d232baf770a2b9 Mon Sep 17 00:00:00 2001 From: Patrick Filler Date: Wed, 28 Sep 2011 13:29:00 -0400 Subject: [PATCH] Add deselect examples. --- example.jquery.html | 20 +++++++++++++++++++- example.proto.html | 23 +++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/example.jquery.html b/example.jquery.html index 7cecc75..846d6c4 100644 --- a/example.jquery.html +++ b/example.jquery.html @@ -1217,6 +1217,24 @@ $(".chzn-select").chosen({no_results_text: "No results matched"}); + +

Allow Deselect on Single Selects

+
+

When a single select box isn't a required field, you can set allow_single_deselect: true and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.

+
+ +
+

Right to Left Support

@@ -1279,6 +1297,6 @@
- + diff --git a/example.proto.html b/example.proto.html index a37a163..e113781 100644 --- a/example.proto.html +++ b/example.proto.html @@ -1217,6 +1217,24 @@ +

Allow Deselect on Single Selects

+
+

When a single select box isn't a required field, you can set allow_single_deselect: true and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.

+
+ +
+
+

Right to Left Support

Chosen supports right to left select boxes too. just add "chzn-rtl" in addition to "chzn-select" to your select tags and you are good to go.

@@ -1290,6 +1308,11 @@ select = selects[_i]; _results.push(new Chosen(select)); } + deselects = $$(".chzn-select-deselect"); + for (_i = 0, _len = deselects.length; _i < _len; _i++) { + select = deselects[_i]; + _results.push(new Chosen(select,{allow_single_deselect:true})); + } return _results; });