diff --git a/src/main/java/net/bootsfaces/component/panel/PanelRenderer.java b/src/main/java/net/bootsfaces/component/panel/PanelRenderer.java index 75e575df1..da9bce805 100644 --- a/src/main/java/net/bootsfaces/component/panel/PanelRenderer.java +++ b/src/main/java/net/bootsfaces/component/panel/PanelRenderer.java @@ -145,16 +145,7 @@ public void encodeBegin(FacesContext context, UIComponent component) throws IOEx rw.writeAttribute("class", "panel-title", "class"); } if (isCollapsible) { - rw.startElement("a", panel); - rw.writeAttribute("data-toggle", "collapse", "null"); - rw.writeAttribute("data-target", "#" + jQueryClientID + "content", "null"); - rw.writeAttribute("href", "javascript:;", "null"); - if (panel.isCollapsed()) { - rw.writeAttribute("class", "collapsed", null); - } - if(null != accordionParent) { - rw.writeAttribute("data-parent", "#" + accordionParent, null); - } + writeTitleLink(panel, rw, jQueryClientID, accordionParent); } rw.writeText(_title, null); @@ -164,16 +155,7 @@ public void encodeBegin(FacesContext context, UIComponent component) throws IOEx rw.endElement("h4"); } else { if (isCollapsible) { - rw.startElement("a", panel); - rw.writeAttribute("data-toggle", "collapse", "null"); - rw.writeAttribute("data-target", "#" + jQueryClientID + "content", "null"); - rw.writeAttribute("href", "javascript:;", "null"); - if (panel.isCollapsed()) { - rw.writeAttribute("class", "collapsed", null); - } - if(null != accordionParent) { - rw.writeAttribute("data-parent", "#" + accordionParent, null); - } + writeTitleLink(panel, rw, jQueryClientID, accordionParent); } head.encodeAll(context); if (isCollapsible) { @@ -208,6 +190,21 @@ public void encodeBegin(FacesContext context, UIComponent component) throws IOEx rw.writeAttribute("class", "panel-body", "class"); } + private void writeTitleLink(Panel panel, ResponseWriter rw, String jQueryClientID, String accordionParent) + throws IOException { + rw.startElement("a", panel); + rw.writeAttribute("data-toggle", "collapse", "null"); + rw.writeAttribute("data-target", "#" + jQueryClientID + "content", "null"); + rw.writeAttribute("style", "display: block", "style"); //let the anchor + rw.writeAttribute("href", "javascript:;", "null"); + if (panel.isCollapsed()) { + rw.writeAttribute("class", "collapsed", null); + } + if(null != accordionParent) { + rw.writeAttribute("data-parent", "#" + accordionParent, null); + } + } + /** * This methods generates the HTML code of the current b:panel. * encodeBegin generates the start of the component. After the,