0

variable dialogTitle="[' + rowObject.date + '] is not evaluated in the

What is the problem.

'<div style="margin-left: 42px; margin-right: 42px;">
                <img class="detail-view-hyperlink" height="20" width="20"
                    view="processStatusDetailView" refNum="' + rowObject[refNum] + '"
                    dialogTitle="[' + rowObject.date + '] [' + colName + '] '+DURGA$MAF$i18n.title.processStatusDetail+'"
                    src="'+FINCH.context.path+'/images/inf/'+fontSpan+'" title="'+rowObject[reason]+'"
                    href="/maf/process/history/statusDetails/' + rowObject[refNum] +'/' + rowObject[detailRefNum] +'?commandFormId=' +cfId+'" />
            </div>';

1 Answers1

0

Javascript treats new line (\n) as a the end of the statement, So , code from 2nd line onwards <img ... are treated a javascript code instead of the part of the HTML string.

Use + concatenation on each line break instead Eg.

var myDiv = '<div style="margin-left: 42px; margin-right: 42px;">'
            + '<img class="detail-view-hyperlink" height="20" width="20"'
            +       'view="processStatusDetailView" refNum="' + rowObject[refNum] + '"'
            +        'dialogTitle="[' + rowObject.date + '] [' + colName + '] '+DURGA$MAF$i18n.title.processStatusDetail+'"'
            +        'src="'+FINCH.context.path+'/images/inf/'+fontSpan+'" title="'+rowObject[reason]+'"'
            +        'href="/maf/process/history/statusDetails/' + rowObject[refNum] +'/' + rowObject[detailRefNum] +'?commandFormId=' +cfId+'" />'
            + '</div>';

Hope this helps?

In ES6

you can use templating to support multiline Eg

var myDiv = `<div style="margin-left: 42px; margin-right: 42px;">
              <img class="detail-view-hyperlink" 
                 height="20" width="20"
                 view="processStatusDetailView"
                 refNum="${rowObject[refNum]}"
                 dialogTitle="[${rowObject.date} + '] [${colName}] ${DURGA$MAF$i18n.title.processStatusDetail}"
                 src="${FINCH.context.path}/images/inf/${fontSpan}"
                 title="${rowObject[reason]}"
                 href="/maf/process/history/statusDetails/${rowObject[refNum]}/${rowObject[detailRefNum]}?commandFormId=${cfId}" 
              />
            </div>`;

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

Abhilash Nayak
  • 644
  • 4
  • 10