EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on March 25, 2016, 11:22:53 AM



Title: css class to a dialog
Post by: korenanzo on March 25, 2016, 11:22:53 AM
Hi,

how can I add a css class to a dialog() ?
using 'cli' does not work:
$('#dd').dialog({
    title: 'My Dialog',
    width: 400,
    height: 200,
    closed: false,
    modal: true,
   cos:'myClass'
});


Title: Re: css class to a dialog
Post by: jarry on March 25, 2016, 11:38:10 PM
Just call 'addClass' method to add a class to the dialog.
Code:
$('#dd').addClass('cli').dialog({
...
});


Title: Re: css class to a dialog
Post by: korenanzo on March 29, 2016, 01:38:56 AM
Just call 'addClass' method to add a class to the dialog.


This way I add a class to the  inner box, that is the body of my dialog, but it's not what I need: I'd like to add a class to the outer, the window itself.

My goal is: to set the max-width and max-height of the whole dialog, because I don't know how much text my dialog will contain, so I  want the dialog growth automatically (according to the amount of content), but not too much.

Is there another way to achieve this?


RIc


Title: Re: css class to a dialog
Post by: jarry on March 30, 2016, 01:44:26 AM
To limit the max height of a dialog, just set the 'maxHeight' property value for it.
Code:
$('#dlg').dialog({
maxHeight: 200,
height: 'auto'
})