- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 01:26 AM
Hi,
I am attaching a screenshot of output of my requirement and it is working fine,but i want to print Incident,Shortdescription and priority for my columns.How to do that?
On top of each column i need to provide name.
I have tried adding <td> but didn achieve it pls somebody help.
if (gr.getRowCount() > 0) {
template.print('<table border="1"><th colspan="4" style="text-align:center">Incident Report </th> ');
while (gr.next()) {
template.print('<tr><th><a href=' + baseUrl + gr.getLink() + '>' + gr.getValue('number') + '</a></th><th>' + gr.short_description + '</th><th>' + gr.getDisplayValue('state') + '</th><th>' + '</th></tr>');
}
Regards,
Gayathri
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 01:34 AM
Hi
You can add the below format inside your if condition and modify the columns accordingly
template.print('<br />');
template.print('<table style="height: 23px;" width="100%"><tbody><tr><td style="background-color: #0e5399;"><font color="#FFFFFF"><strong>Closed Projects</strong></font></td></tr></tbody></table>');
var tbl = '<table style="height: 293px;" width="100%"><tbody>';
//template.print(tbl);
var tab = '<table style="width: 100%; border-collapse : collapse; " border = "2" cellpadding = "10"> <tbody>' +
'<tr>' + '<td style="background-color: #aeaeae;">' + '<b>Number</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>State</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Short description</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Caller</b>' + '</td>' +
'</tr>';
template.print(tab);
var clsed = '<tr>' + '<td>' + gr.number + '</td>' +
'<td>' + gr.getDisplayValue('state') + '</td>' +
'<td>' + gr.getValue('short_description') + '</td>' +
'<td>' + gr.caller_id.name + '</td>' +
'</tr>';
template.print(clsed);
}
var tab_end = '</tbody> </table>';
template.print(tab_end);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 01:32 AM
if (gr.getRowCount() > 0) {
template.print('<table border="1"><tr><th colspan="4" style="text-align:center">Incident Report </th></tr><tr><th><p>Incident</p></th><th><p>Short Description</p></th><th><p>State</p></th><th></th></tr> ');
while (gr.next()) {
template.print('<tr><th><a href=' + baseUrl + gr.getLink() + '>' + gr.getValue('number') + '</a></th><th>' + gr.short_description + '</th><th>' + gr.getDisplayValue('state') + '</th><th>' + '</th></tr>');
}
template.print('</table>');
I think that should do it (just updated it as I didn't spot the 4th column).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 01:57 AM
Hi wayne,
Is this HTML table creation syntax we have to use? Thanks its working as expected.
Regards,
Gayathri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 01:34 AM
Hi
You can add the below format inside your if condition and modify the columns accordingly
template.print('<br />');
template.print('<table style="height: 23px;" width="100%"><tbody><tr><td style="background-color: #0e5399;"><font color="#FFFFFF"><strong>Closed Projects</strong></font></td></tr></tbody></table>');
var tbl = '<table style="height: 293px;" width="100%"><tbody>';
//template.print(tbl);
var tab = '<table style="width: 100%; border-collapse : collapse; " border = "2" cellpadding = "10"> <tbody>' +
'<tr>' + '<td style="background-color: #aeaeae;">' + '<b>Number</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>State</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Short description</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Caller</b>' + '</td>' +
'</tr>';
template.print(tab);
var clsed = '<tr>' + '<td>' + gr.number + '</td>' +
'<td>' + gr.getDisplayValue('state') + '</td>' +
'<td>' + gr.getValue('short_description') + '</td>' +
'<td>' + gr.caller_id.name + '</td>' +
'</tr>';
template.print(clsed);
}
var tab_end = '</tbody> </table>';
template.print(tab_end);