oneofakind
oneofakind

Reputation: 562

Extjs Message Box Center Align

As the title says, I would like the message of Ext.Msg.alert() to in center align. I tried this:

 Ext.Msg.alert({
        title: 'Success',
        msg: 'Deleted',
        buttons: Ext.Msg.OK,
        baseCls: 'msgbox'
    });

CSS:

 .msgbox {
      text-align: center;
  }

It is still on left align. How do I do this?

Upvotes: 0

Views: 4744

Answers (1)

lontivero
lontivero

Reputation: 5275

The displayed text is a displayfield component that has the same size that its text then, even when it is centered, you cannot see it aligned as you want.

So, the solution is to make it bigger. In my example i do it using a css class. Take a look at it:

var w = Ext.Msg.alert({
        title: 'Success',
        msg: 'Deleted',
        buttons: Ext.Msg.OK,
        autoShow: false,
        cls: 'msgbox'    
});

w.down('.displayfield' ).addCls('displayfield-fullsize');

and the class is, as you can imagine:

.displayfield-fullsize{
       width: 100% !important;
}

See it working here: http://jsfiddle.net/lontivero/F7HE3/3/

Upvotes: 1

Related Questions