json-forms
json-forms copied to clipboard
Rendering in DIVs not Tables
Is it possible to configure json-forms to reder forms in DIVS or another container instead of a table? Thanks
Sorry @kokujin it cannot be changed with the current implementation, but shouldn't be difficult to do.
@kokujin
You can accomplish the required by doing the following.
code start line: 511 in js file
var table = document.createElement("div");
table.className = "row";
var tbody = document.createElement("tbody");
appendChild(table, tbody, s);
var propNum = 0;
if (s.hasOwnProperty("properties")) {
propNum = s.properties.length;
for (var prop in s.properties) {
var tr = document.createElement("div");
tr.className = "col-xs-12 col-sm-6 form-group";
var td1 = document.createElement("div");
td1.className = "m-t-md";
var propId = id + "." + prop;
var td2 = document.createElement("div");
td2.className = " prop-value";
appendChild(tbody, tr, s);
appendChild(tr, td1, s);
appendChild(tr, td2, s);
var pp = createStaticPropertyProvider(prop);
var propInitialValue = null;
if (value) {
propInitialValue = value[prop];
}
render(td1, td2, propId, current, pp, propInitialValue);
}
}