Skip to content

Commit

Permalink
fix: update rowIndex width when row count changes (#138)
Browse files Browse the repository at this point in the history
* fix: update rowIndex width when row count changes

* fix: removed unwanted code

* fix: Added Refresh Data button
  • Loading branch information
shariquerik committed Aug 20, 2021
1 parent cb27294 commit 8ceadac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

<body>
<h1>Frappé DataTable</h1>
<button onclick="datatable.render()">Refresh</button>
<button onclick="datatable.render()">Render Table</button>
<button onclick="datatable.refresh()">Refresh Data</button>
<button onclick="switchToTreeView()" data-action="treeview">TreeView</button>
<label>
<input type="checkbox" id="input-large-data" />
Expand Down
8 changes: 3 additions & 5 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ export default class Style {

let naturalWidth = $.style($('.dt-cell__content', $cell), 'width');

if (column.id === '_rowIndex') {
naturalWidth = this.getRowIndexColumnWidth();
column.width = naturalWidth;
}

if (typeof naturalWidth === 'number' && naturalWidth >= column.naturalWidth) {
column.naturalWidth = naturalWidth;
} else {
Expand Down Expand Up @@ -245,6 +240,9 @@ export default class Style {
if (!column.width) {
column.width = column.naturalWidth;
}
if (column.id === '_rowIndex') {
column.width = this.getRowIndexColumnWidth();
}
if (column.width < this.options.minimumColumnWidth) {
column.width = this.options.minimumColumnWidth;
}
Expand Down

0 comments on commit 8ceadac

Please sign in to comment.