Ext js 5 SyntaxError:não terminada de seqüência de caracteres literal problema

StackOverflow https://stackoverflow.com//questions/25052405

  •  21-12-2019
  •  | 
  •  

Pergunta

Eu teste abaixo o código do Extjs5:

Ext.create('Ext.window.Window', {
        title: 'try extjs text area',
        width: 900,
        height: 500,
        layout: 'fit',
        items: [{ 
            xtype: 'textarea',
            value: ' The first line \n The second line',
            border: true,
            autoScroll: true,
            draggable: true
        }]
     }
    ).show();

O problema é o conteúdo do texto que contêm como abaixo :valor:'A primeira linha A segunda linha',

e ele terá de erro:SyntaxError:não terminada literal de cadeia de caracteres

Mas eu preciso apresentar uma nova linha no textarea .O que é correto soluções para isso ?

BTW , Esse problema é causado por Árvore Painel de renderização :

Eu tenho um método de renderização como o abaixo MainController.js :

    renderLogs: function (logs, p, record) {
     return logs?  '<div><img src="default-more.png" /
       onclick="Ext.create(\'Ext.window.Window\', /
         { title: \'try extjs text area\', /
           width: 900,height: 500, /
           layout: \'fit\', /
           items: [{xtype: \'textarea\', /
           value: \'"+logs+"\', /
           border: true,autoScroll: true,draggable: true}]}).show(); "> /
      </img></div>' : '';
   }

Assim, se os logs de conteúdo , ele vai ter ERRO - SyntaxError:não terminada literal de cadeia de caracteres

Foi útil?

Solução

Dentro de 'itens' parâmetro:o texto não é correto", sub-parâmetro' de 'textarea', 'valor' é o correto.Esse era o problema.O código correto é:Ext.create('Ext.window.Window', { title: 'try extjs text area', width: 900, height: 500, layout: 'fit', items: { xtype: 'textarea', value: ' The first line \n The second line', border: true, autoScroll: true, draggable: true }} ).show();

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top