Joao Aguas Joao Aguas - 5 months ago 28
Javascript Question

How to change line in Ext.MessageBox message?

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...

enter image description here

Answer

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
});

enter image description here

Comments