Skip to content

Commit

Permalink
fix(grid): convert % to px when calculating default width #1245
Browse files Browse the repository at this point in the history
  • Loading branch information
DiyanDimitrov committed Nov 14, 2018
1 parent 44d1e98 commit 6ba96bc
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3434,7 +3434,14 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
const columnsToSize = visibleChildColumns.length - columnsWithSetWidths.length;

const sumExistingWidths = columnsWithSetWidths
.reduce((prev, curr) => prev + parseInt(curr.width, 10), 0);
.reduce((prev, curr) => {
const colWidth = curr.width;
const widthValue = parseInt(colWidth, 10);
const currWidth = colWidth && typeof colWidth === 'string' && colWidth.indexOf('%') !== -1 ?
widthValue / 100 * computedWidth :
widthValue;
return prev + currWidth;
}, 0);

const columnWidth = !Number.isFinite(sumExistingWidths) ?
Math.max(computedWidth / columnsToSize, MINIMUM_COLUMN_WIDTH) :
Expand Down

0 comments on commit 6ba96bc

Please sign in to comment.