myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject [myfaces-tobago] 12/19: Tobago-1999: placeholder on selectOneChoice
Date Fri, 29 Nov 2019 15:46:03 GMT
This is an automated email from the ASF dual-hosted git repository.

weber pushed a commit to branch TOBAGO-1999_Select2
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 4b75278279f35a9a22f516b0af9c06fb44fae3d9
Author: Volker Weber <v.weber@inexso.de>
AuthorDate: Tue Aug 27 17:46:40 2019 +0200

    Tobago-1999: placeholder on selectOneChoice
---
 .../src/main/webapp/content/25-select/00-select2/select2.xhtml   | 9 ++++-----
 .../html/standard/standard/tag/SelectOneChoiceRenderer.java      | 6 +++++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
b/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
index 7a6efab..7dad3ba 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
@@ -63,11 +63,11 @@
           <tc:selectItem itemLabel="Fax" itemValue="fax"/>
         </tc:selectOneChoice>
 
-        <tc:label value="Suppressed filter input " for="one_2"/>
+        <tc:label value="Suppressed filter input with placeholder" for="one_2"/>
         <tc:selectOneChoice id="one_2"
                             minimumResultsForSearch="10"
-                            value=""
-                            select2="true">
+                            placeholder="Please select message type"
+                            value="">
 
           <tc:selectItem itemLabel="Letter" itemValue="letter"/>
           <tc:selectItem itemLabel="Phone" itemValue="phone"/>
@@ -80,8 +80,7 @@
                             allowCustom="true"
                             placeholder="Custom input allowed"
                             allowClear="true"
-                            value=""
-                            select2="true">
+                            value="">
 
           <tc:selectItem itemLabel="Letter" itemValue="letter"/>
           <tc:selectItem itemLabel="Phone" itemValue="phone"/>
diff --git a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
index 6894df1..6fe0360 100644
--- a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
+++ b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
@@ -99,7 +99,11 @@ public class SelectOneChoiceRenderer extends SelectOneRendererBase {
     }
     HtmlRendererUtils.renderCommandFacet(select, facesContext , writer);
     HtmlRendererUtils.renderFocus(id, select.isFocus(), ComponentUtils.isError(select), facesContext,
writer);
-    
+    if (renderAsSelect2 && select.getPlaceholder() != null && select.getPlaceholder().length()
> 0) {
+     writer.startElement(HtmlElements.OPTION, null);
+     writer.endElement(HtmlElements.OPTION);
+    }
+
     HtmlRendererUtils.renderSelectItems(select, items, select.getValue(), (String) select.getSubmittedValue(),
writer,
         facesContext);
 


Mime
View raw message