diff --git a/src/ui/grid.js b/src/ui/grid.js index dc672cee499afc693d8e59c407da7bdd5e765b8b..e2fcd8eb13d0996ffcc76e37e18b53b152884f03 100644 --- a/src/ui/grid.js +++ b/src/ui/grid.js @@ -301,10 +301,14 @@ morpheus.Grid.prototype = { if (!items || items.length == 0) { return; } - if (!columns || columns.length <= 1) { + if (!columns || columns.length === 0) { return; } this.columnsAutosized = true; + if (columns.length <= 1) { + return; + } + var div = document.createElement('div'); document.body.appendChild(div); var $d = $(div); @@ -325,7 +329,7 @@ morpheus.Grid.prototype = { var gridWidth = this.options.$el.width() - 30; var maxWidth = Math.min(parseInt(gridWidth / 2), 400); var getColumnWidth = function (column) { - var w = $header.html(column.name).outerWidth(); + var w = $header.html(column.name).outerWidth() + 12; if (column.prototypeValue) { $cell.html(column.prototypeValue); @@ -337,7 +341,6 @@ morpheus.Grid.prototype = { var $html = $(html); $html.find('.slick-cell-wrapper').attr('class', ''); $cell.html($html); - w = Math.max($cell.outerWidth(), w); } }