You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 21, 2022. It is now read-only.
I was wondering if we can add templates dynamically, i.e. to create a select with values , put it in a template and add it to the sortable table. This is my code:
cellTemplate = "newCellTemplate";
var el = document.createElement("template");
el.id = cellTemplate;
var td = document.createElement("td");
el.appendChild(td);
var select = document.createElement("select");
select.setAttribute("type", "text");
td.appendChild(select);
for (var i = 0; i < this.categoricalValues.length; i++) {
var option = document.createElement("option");
option.value = this.categoricalValues[i];
var text = document.createTextNode(this.categoricalValues[i]);
option.appendChild(text);
select.appendChild(option);
}
this.$.sortable_table.shadowRoot.appendChild(el);
//this.$.sortable_table.appendChild(el);
The html element is well created and you can see the element in DOM, but it does not appear what was expected. If I put the template directly, not programatically in the code it works good, so it is not the way the template is created:
Hello,
I was wondering if we can add templates dynamically, i.e. to create a select with values , put it in a template and add it to the sortable table. This is my code:
cellTemplate = "newCellTemplate";
var el = document.createElement("template");
el.id = cellTemplate;
var td = document.createElement("td");
el.appendChild(td);
var select = document.createElement("select");
select.setAttribute("type", "text");
td.appendChild(select);
for (var i = 0; i < this.categoricalValues.length; i++) {
var option = document.createElement("option");
option.value = this.categoricalValues[i];
var text = document.createTextNode(this.categoricalValues[i]);
option.appendChild(text);
select.appendChild(option);
}
this.$.sortable_table.shadowRoot.appendChild(el);
//this.$.sortable_table.appendChild(el);
The html element is well created and you can see the element in DOM, but it does not appear what was expected. If I put the template directly, not programatically in the code it works good, so it is not the way the template is created:
Regards, thank you