Skip to content

Commit

Permalink
release(data-grid): v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Nov 22, 2024
1 parent a097355 commit df380e3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"data-grid": {
"react": true,
"icon": true,
"version": "1.2.0",
"version": "1.2.1",
"style": true,
"test": true,
"install": false,
Expand Down
4 changes: 4 additions & 0 deletions src/data-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.1 (22 Nov 2024)

* fix: scroll position not restored

## 1.2.0 (15 Nov 2024)

* feat: setData api
Expand Down
8 changes: 7 additions & 1 deletion src/data-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default class DataGrid extends Component<IOptions> {
private $tableBody: $.$
private $colgroup: $.$
private $dataContainer: $.$
private dataContainer: HTMLDivElement
private $resizers: $.$
private resizeIdx = 0
private resizeStartX = 0
Expand Down Expand Up @@ -157,6 +158,7 @@ export default class DataGrid extends Component<IOptions> {
this.tableBody = this.$tableBody.get(0) as HTMLElement
this.$colgroup = this.$container.find('colgroup')
this.$dataContainer = this.find('.data-container')
this.dataContainer = this.$dataContainer.get(0) as HTMLDivElement

this.renderHeader()
this.renderResizers()
Expand Down Expand Up @@ -565,7 +567,9 @@ export default class DataGrid extends Component<IOptions> {
}
}
private renderData() {
const { tableBody, displayNodes, fillerRow } = this
const { tableBody, displayNodes, fillerRow, dataContainer } = this

const scrollTop = dataContainer.scrollTop

this.detachAll()
const frag = document.createDocumentFragment()
Expand All @@ -575,6 +579,8 @@ export default class DataGrid extends Component<IOptions> {
tableBody.insertBefore(frag, fillerRow)

this.updateHeight()

dataContainer.scrollTop = scrollTop
}
private detachAll() {
const { tableBody } = this
Expand Down
2 changes: 1 addition & 1 deletion src/data-grid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-grid",
"version": "1.2.0",
"version": "1.2.1",
"description": "Grid for displaying datasets",
"luna": {
"react": true,
Expand Down

0 comments on commit df380e3

Please sign in to comment.