admin管理员组

文章数量:1432449

How to change line in Ext.MessageBox message?

if (duplicatedRecords.length > 0) {

    var msg = '';

    duplicatedRecords.forEach(function(element) {
        msg += ' - ' + element.get('ClientName') + '\n';
    });

    Ext.MessageBox.show(
    {
        title: 'Record(s) already exists',
        msg: msg,
        icon: Ext.MessageBox.ERROR,
        buttons: Ext.Msg.OK,
        closable: false
    });

}

I've tried with '\n' and doesn't work...

How to change line in Ext.MessageBox message?

if (duplicatedRecords.length > 0) {

    var msg = '';

    duplicatedRecords.forEach(function(element) {
        msg += ' - ' + element.get('ClientName') + '\n';
    });

    Ext.MessageBox.show(
    {
        title: 'Record(s) already exists',
        msg: msg,
        icon: Ext.MessageBox.ERROR,
        buttons: Ext.Msg.OK,
        closable: false
    });

}

I've tried with '\n' and doesn't work...

Share Improve this question asked Sep 19, 2014 at 16:08 Joao AguasJoao Aguas 501 silver badge8 bronze badges 1
  • In the dialog image, it looks like you're using /n instead of \n. Is the framework you're using changing them or something? – APerson Commented Sep 19, 2014 at 16:10
Add a ment  | 

2 Answers 2

Reset to default 6

This is rendering HTML, so you can just add a 'br':

Sencha fiddle

Ext.MessageBox.show(
{
    title: 'Record(s) already exists',
    msg: "msg<br/>msg",
    icon: Ext.MessageBox.ERROR,
    buttons: Ext.Msg.OK,
    closable: false
});

Message is just and HTML, so you can use <br> if you want to do it manually.

If your text is big it will automatically wrap your text.

本文标签: javascriptHow to change line in ExtMessageBox messageStack Overflow