-
1. Re: modalpanel and scrollbars
ilya_shaikovsky Jul 11, 2007 5:41 AM (in response to tomzi)You may put the div element as a child to modal panel and include all you content to this div. After set the scrolls for this element.
-
2. Re: modalpanel and scrollbars
tomzi Jul 11, 2007 6:13 AM (in response to tomzi)I'm currently trying that - but I have difficulties making the scrollbars fit within the modalpanel, since style="height:100%" together with 'overflow:auto' makes the scrollbars larger than the modalpanel.
-
3. Re: modalpanel and scrollbars
tomzi Jul 12, 2007 10:25 AM (in response to tomzi)For those who are interested. I found a way to add a scrollbar to the modalpanel. The main problem is that if I used the .rich-mpnl-body class to overwride with overflow:auto!important it always needed the height attribute as well. But since % are ugly to use I searched a little bit through the html source-code and found the .dr-mpnl-pnl class which adds a scrollbar nicely fitted in the modal-panel.
<style type="text/css"> .dr-mpnl-pnl {overflow:auto!important} .rich-mpnl-body { height: 92%; width:99%; padding:0px; } .rich-mpnl-body .content { padding: 10px; } </style>
<a href="javascript:Richfaces.showModalPanel('webacform3:panel3')"> <h:outputText id="currentlySelectedProduct" value="#{chooseActivation_backing.productTypes.selectedProduct == null ? 'Produkt auswählen' : chooseActivation_backing.productTypes.selectedProduct.name}"/></a> <rich:modalPanel id="panel3" resizeable="false" moveable="false" height="300" width="400"> <f:facet name="header"> <h:outputText value="Produkt auswählen"></h:outputText> </f:facet> <f:facet name="controls"> <a href="javascript:Richfaces.hideModalPanel('webacform3:panel3')">X</a> </f:facet> <div class="content" >Mögliche Produkte: <br /> <rich:tree id="tree" switchType="client" value="#{chooseActivation_backing.productTypes.currentProducts2}" var="data" ajaxSubmitSelection="true" reRender="currentlySelectedProduct" preserveModel="none" immediate="false" nodeSelectListener="#{chooseActivation_backing.productTypes.onTreeSelect}"> </rich:tree></div> </rich:modalPanel>
-
4. Re: modalpanel and scrollbars
andi404 Feb 19, 2010 3:54 AM (in response to tomzi)It seems that this solution doesn't work if <rich:modalPanel autosize="true">... -
5. Re: modalpanel and scrollbars
ilya_shaikovsky Feb 19, 2010 4:19 AM (in response to andi404)if panel autosized - it's expanded to the content. Where do you want scrolls in this case? -
6. Re: modalpanel and scrollbars
andi404 Feb 19, 2010 4:27 AM (in response to ilya_shaikovsky)Right, the modal panel will be expanded according to the size of its content. However, if your browser window is too small, no scrollbars will be attached to the modal panel and you can only see a small part of the panel. -
7. Re: modalpanel and scrollbars
ilya_shaikovsky Feb 19, 2010 4:45 AM (in response to andi404)modal panel in this case expanded to the size of content. And not depends on browser window size. -
8. Re: modalpanel and scrollbars
andi404 Feb 19, 2010 5:19 AM (in response to ilya_shaikovsky)Yes, you said that before... however, that doesn't solve the problem.
For instance: Suppose that your panel content is higher than your browser window's height. In addition, suppose that your modalpanel resides in a container with a fixed height. Then, if the panel pops up, no scrollbar will be attached to the browser's window and you won't be able to scroll to the bottom of the modal box.
-
9. Re: modalpanel and scrollbars
sergeysmirnov Feb 19, 2010 7:46 PM (in response to andi404)What I have in my project is below. The dialog height is adopted for the height of the window. The scroll is appeared only if no enough space for content. resizeCTDialog() is invoked when windows is resized. The listener is added on the parent page with
jQuery(window).bind('resize', function() {resizeCTDialog()})
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:rich="http://richfaces.org/rich"><rich:modalPanel id="ctDialog"
onshow="adoptCTDialogHeight()"
autosized="true">
<a4j:form>
<a4j:outputPanel id="createLibraryTasks" layout="block">
<a4j:outputPanel id="ctContent" styleClass="dte-content" layout="block">dialog content here
</a4j:outputPanel>buttons
</a4j:outputPanel>
</a4j:form>
</rich:modalPanel>
<script>
//<![CDATA[
function adoptCTDialogHeight() {if (jQuery(window).height() -
jQuery(#{rich:element('ctContent')}).height() < 130) {
addScrollToCTDialog();
}
}function resizeCTDialog() {
if (#{rich:component('ctDialog')}.shown) {
#{rich:component('ctDialog')}.hide();
resetScrollToCTDialog();
#{rich:component('ctDialog')}.show();
adoptCTDialogHeight();
}
}
//]]>
</script>
<rich:jQuery name="addScrollToCTDialog" timing="onJScall" selector="#ctContent"
query="css('overflow-y','auto').css('overflow-x','hidden').css('height', jQuery(window).height() - 130)" />
<rich:jQuery name="resetScrollToCTDialog" timing="onJScall" selector="#ctContent"
query="css('height','auto').css('overflow-y','auto').css('overflow-x','hidden')" />
</ui:composition> -
10. Re: modalpanel and scrollbars
kiekie96 Sep 23, 2010 3:14 AM (in response to tomzi)If you use DIV and got difficult to adjust DIV size to modal panel size, you can use this tricked
http://www.hell0w0rld.co.cc/2010/09/how-to-make-scroll-bar-in-richfaces-modalpanel/
-
11. Re: modalpanel and scrollbars
klaus11 Aug 2, 2013 6:11 AM (in response to kiekie96)I have a scrolllbar with an div between the richfaces modalpanel, and everything works fine, also when I resize the window.
the only problem is, that when I popup up the modalpanel, the scrolling from the main page is also used when I reach the bottom of the scrolling in the modal panel.
overflow: hidden would be great for the html or body section in that time when I popup the modal panel.
Anyone any idea how to pass this on to the main styles ?
thanks,Klaus