How to remove scrollbar in PrimeFaces dialog?
css, primefaces
Solution
In you `statusDialog` dialog add `styleClass="disable-scroll"`.
Also, create CSS rule for this:
.disable-scroll .ui-dialog-content {
overflow: hidden !important;
}
This will apply CSS to all dialogs with this custom class.
Problem
I have ajax loading modal dialog in my webapp: ``` <p:dialog widgetVar="statusDialog" modal="true" draggable="false" minimizable="false" appendToBody="true" closable="false" header="Processing..." resizable="false" maximizable="false" style="overflow:hidden !important; overflow-x: hidden !important; width:auto;"> <p:graphicImage library="assets" name="ajax-loader.gif" style="overflow:hidden !important; overflow-x: hidden !important;"></p:graphicImage> </p:dialog> <p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/> ``` No matter what CSS styles (I tried various combinations of overflow/overflow-x etc) I use it still displays horizontal (vertical is hidden, no problems there) scrollbar. I also played around with appendToBody attribute. I need to disable the horizontal scrollbar. EDIT: this is the HTML rendered by PrimeFaces ``` <div id="j_idt18" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-shadow ui-overlay-hidden" style="overflow: hidden; width: auto; height: auto; left: 832px; top: 210px; visibility: hidden; z-index: 1003; display: block;" role="dialog" aria-labelledby="j_idt18_title" aria-hidden="true" aria-live="off"> <div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"> <span id="j_idt18_title" class="ui-dialog-title">Processing...</span> </div> <div class="ui-dialog-content ui-widget-content" style="height: auto;"><img id="j_idt19" src="/webapp/do/javax.faces.resource/ajax-loader.gif?ln=assets" alt=""> </div> </div> ``` I have been able to get rid of the scrollbar by overriding default dialog CSS in my own stylesheet: ``` .ui-dialog-content { overflow: hidden !important; } ``` However, this affects all dialogs, not just the ajax loading one. I want to be able to override that style on per-dialog basis. How do I do that?