cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Create dynamic html table format in thingworx's services.

Hrishabh.Sharma
12-Amethyst

Create dynamic html table format in thingworx's services.

var data = me.Data; //InfoTable 
var result;
result = "<!DOCTYPE html><html><head></head><body>" +
"<table style='width: 100%; border-collapse: collapse;'>" +
"<thead>" +
"<tr>" +
"<th style='border: 1px solid black; color: white; padding: 8px; text-align: center; background-color: #005495;'>Column 1</th>" +
"<th style='border: 1px solid black; color: white; padding: 8px; text-align: center; background-color: #005495;'>Column 2</th>" +
"<th style='border: 1px solid black; color: white; padding: 8px; text-align: center; background-color: #005495;'>Column 3</th>" +
"</tr>" +
"</thead>" +
"<tbody>";
// Iterate over the rows of the InfoTable
for (var i = 0; i < data.rows.length; i++) {
var row = data.rows[i];
result += "<tr>";
// Iterate over each column in the row
for (var key in row) {
var value = row[key];
result += "<td style='border: 1px solid black; padding: 8px; text-align: center;'>" + value + "</td>";
}
result += "</tr>";
}
result += "</tbody>" +
"</table>" +
"</body></html>";
ACCEPTED SOLUTION

Accepted Solutions

Hi @Hrishabh.Sharma  can you look at the below article for your reference, let me know your output.

https://www.ptc.com/en/support/article/CS402961?source=search

View solution in original post

1 REPLY 1

Hi @Hrishabh.Sharma  can you look at the below article for your reference, let me know your output.

https://www.ptc.com/en/support/article/CS402961?source=search

Announcements


Top Tags