diff --git a/webroot/js/bootstrap-helper.js b/webroot/js/bootstrap-helper.js index c70c7b0..94aa6f2 100644 --- a/webroot/js/bootstrap-helper.js +++ b/webroot/js/bootstrap-helper.js @@ -1124,12 +1124,16 @@ class HtmlHelper { if (options.variant) { $table.addClass(`table-${options.variant}`) } + if (options.fixed_layout) { + $table.css('table-layout', 'fixed') + } if (options.tableClass) { $table.addClass(options.tableClass) } - const $caption = $('') + let $caption = null if (options.caption) { + $caption = $('') if (options.caption instanceof jQuery) { $caption = options.caption } else { @@ -1137,21 +1141,28 @@ class HtmlHelper { } } - const $theadRow = $('') - head.forEach(head => { - if (head instanceof jQuery) { - $theadRow.append($('').append(head)) - } else { - $theadRow.append($('').text(head)) - } - }) - $thead.append($theadRow) + let $theadRow = null + if (head) { + $theadRow = $('') + head.forEach(head => { + if (head instanceof jQuery) { + $theadRow.append($('').append(head)) + } else { + $theadRow.append($('').text(head)) + } + }) + $thead.append($theadRow) + } body.forEach(row => { const $bodyRow = $('') row.forEach(item => { if (item instanceof jQuery) { - $bodyRow.append($('').append(item)) + if (item.is('td')) { + $bodyRow.append(item) + } else { + $bodyRow.append($('').append(item)) + } } else { $bodyRow.append($('').text(item)) }