Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Query regarding Dialog window

    Hi,

    We are using SmartGWT Pro 3.0 version.
    I am using Dialog window to display alert
    Dialog dialog = new Dialog();
    dialog.setTitle("Alert");
    dialog.setMessage(message);

    How to use dialog.setMessageStyle() API to change the alignment of message.
    I tried
    dialog.setMessageStyle("align=center");
    dialog.setMessageStyle("{align: center;}");
    dialog.setMessageStyle("align: center");
    but none of them is working.

    Thanks

    #2
    The 'setMessageStyle()' method will impact the css class applied to the message body. So it should be set to a valid CSS class name.

    Comment


      #3
      Intended use fails for me, hack works

      I had the same issue: I wanted to display the error message in red instead of default color.

      On a Dialog object, I tried using dialog.setMessageStyle("my-css-class"), which did not work at all. Also tried dialog.setStyle() but this overrides the whole CSS of the dialog and messes up the display.

      I ended up using:
      dialog.setMessage("<span style='color: "+ "red" + "'>" + message + "</span>");

      and concatenating the CSS and my message worked for me. I am well aware this is a hack and wish I could have found a better solution though. A predefined error mode for a Dialog would have been awesome.

      Comment


        #4
        Originally posted by darkane View Post
        A predefined error mode for a Dialog would have been awesome.
        Not sure about SmartGwt 3 (they are on 5 now, btw) but the Dialog options in 4 and 5 have what you are talking about. There are convenience dialogs for message, data entry, warn, error, etc.

        Comment

        Working...
        X