Skip to content

Commit

Permalink
fix(treeView): Decrease left padding of tree node cells
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris committed Jul 8, 2018
1 parent 9e4d0bb commit 2cf2191
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/cellmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,13 +773,14 @@ export default class CellManager {
if (this.options.treeView && !(isHeader || isFilter) && cell.indent !== undefined) {
const nextRow = this.datamanager.getRow(cell.rowIndex + 1);
const addToggle = nextRow && nextRow.meta.indent > cell.indent;
const leftPadding = 1;

// Add toggle and indent in the first column
const firstColumnIndex = this.datamanager.getColumnIndexById('_rowIndex') + 1;
if (firstColumnIndex === cell.colIndex) {
const padding = ((cell.indent || 0) + 1) * 1.5;
const padding = ((cell.indent || 0) + 1) * leftPadding;
const toggleHTML = addToggle ?
`<span class="dt-tree-node__toggle" style="left: ${padding - 1.5}rem"></span>` : '';
`<span class="dt-tree-node__toggle" style="left: ${padding - leftPadding}rem"></span>` : '';
contentHTML = `<span class="dt-tree-node" style="padding-left: ${padding}rem">
${toggleHTML}${contentHTML}</span>`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
display: inline-block;
position: absolute;
font-size: 10px;
padding: 0 4px;
padding: 2px;
cursor: pointer;
}

Expand Down

0 comments on commit 2cf2191

Please sign in to comment.