Java Table
Table
The cell containing previous definitions and functions is hidden in order to create a more organized blog.
Full code can be found here.
Medias.prototype._toHtml = function() { // inline structure
var style = (
"display:inline-block;" +
"border: 5px solid blue;" +
"box-shadow: 1em 1em 1em red;"
);
var body = ""; // Heading
body += "<tr>";
body += "<th><b>" + "Name" + "</b></th>";
body += "<th><b>" + "Creator" + "</b></th>";
body += "<th><b>" + "Date" + "</b></th>";
body += "<th><b>" + "Type" + "</b></th>";
body += "</tr>"; // Data of Array
for (var row of catalog.medias) {
body += "<tr>";
body += "<td>" + row.name + "</td>";
body += "<td>" + row.cre + "</td>";
body += "<td>" + row.date + "</td>";
body += "<td>" + row.type + "</td>";
body += "<tr>";
}
return ( // div, table, table body
"<div style='" + style + "'>" +
"<table>" +
body +
"</table>" +
"</div>"
);
};
$$.html(catalog._toHtml()); // receives parameter of defined HTML fragment