问题
I am using the extlib Dialog component to display some data. I want the user to only close the dialog via a button I have in it.
I can't see any option to disable the close icon in the title bar. Can someone point me to the documentation on doing this? So far I've checked the wiki + extlib book (maybe I missed it?).
回答1:
css rules, again! As far as I can see there's no "native" way to get rid of that close button (and to be honest, I don't think it's a really good idea to do so; see below). But using some css you of course can hide anything you want on your page.
Just give your dialog some custom styleClass; at runtime this custom class is then added to the dialog's outer div-container. The close button itself is an link inside a span; the has tow style classes, one being "lotusClose". Finally adding this piece of code to your style sheet will hide the button:
div.yourCustomClass a.lotusClose {display:none;}
Caveat: The "close" button is there on purpose. And instead of hiding it I would rather add some kind of validation code to your dialog's close event. There are numerous examples, but maybe you just want to refer to dojotoolkit.org's reference for dijit.Dialog (section "Forms and Functionality in Dialogs).
Btw: since the dialog is based on dijit.Dialog you may also want to browse stackoverflow's dojo section.
来源:https://stackoverflow.com/questions/15973841/how-do-i-remove-the-close-icon-from-the-extlib-dialog