Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/js/core/cell/Cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,36 +98,37 @@ export default class Cell extends CoreFeature{

//generate cell contents
_generateContents(){
var val;

val = this.chain("cell-format", this, null, () => {
return this.element.innerHTML = this.value;
const val = this.chain("cell-format", this, null, () => {
return this.value;
});

switch(typeof val){
case "object":
if(val instanceof Node){

//clear previous cell contents
while(this.element.firstChild) this.element.removeChild(this.element.firstChild);

this._clearCellContent();
this.element.appendChild(val);
}else{
this.element.innerHTML = "";
this._clearCellContent();

if(val != null){
console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val);
}
}
break;
case "undefined":
this.element.innerHTML = "";
this._clearCellContent();
break;
default:
this.element.innerHTML = val;
}
}

_clearCellContent(){
while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
}

cellRendered(){
this.dispatch("cell-rendered", this);
}
Expand Down
Loading