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
8 changes: 7 additions & 1 deletion src/js/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ function jsonToHTML (params) {
}

// Add the row contents and styles
htmlData += '<td style="width:' + properties[n].columnSize + params.gridStyle + '">' + stringData + '</td>'
// if the data is of type array, splitting the cell to multiple rows
if (typeof stringData === 'object' && stringData.length && stringData.length > 0) {
const subTableHtmlData = stringData.reduce((acc, eachRowData) => (acc + '<tr><td style="' + params.gridStyle + '">' + eachRowData + '</td></tr>'), '')
htmlData += '<td style="padding:0;width:' + properties[n].columnSize + params.gridStyle + '"><table style="border-collapse: collapse; width: 100%;">' + subTableHtmlData + '</table></td>'
} else {
htmlData += '<td style="width:' + properties[n].columnSize + params.gridStyle + '">' + stringData + '</td>'
}
}

// Add the row closing tag
Expand Down