Skip to content

Commit e838552

Browse files
committed
fixed onLayout event to detect scrollbar size
1 parent 9454bcc commit e838552

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- added `defaultPrevented` for event data
55
- added `hoverable` for row
66
- fixed text select issue when dragging
7+
- fixed `onLayout` event to detect scrollbar size
78

89
+ 3.1.0
910
- fixed index cache after sort

public/api.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,9 @@
18011801
headerWidth: Number,
18021802
headerHeight: Number,
18031803
bodyWidth: Number,
1804-
bodyHeight: Number
1804+
bodyHeight: Number,
1805+
scrollbarWidth: Number,
1806+
scrollbarHeight: Number
18051807
}
18061808
</code></pre>
18071809
</td>

src/grid/resize.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ export default {
9696
headerWidth: this.headerWidth,
9797
headerHeight: this.headerHeight,
9898
bodyWidth: this.bodyWidth,
99-
bodyHeight: this.bodyHeight
99+
bodyHeight: this.bodyHeight,
100+
scrollbarWidth: this.getScrollbarWidth(),
101+
scrollbarHeight: this.getScrollbarHeight()
100102
};
101103

102104
if (Object.values(layout).join('') === Object.values(previousLayout).join('')) {

test/specs/grid.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,31 +177,28 @@ describe('Grid', function() {
177177

178178
});
179179

180-
it('Grid destroy()', function(done) {
180+
it('Grid destroy()', async () => {
181181
grid.setOption({});
182182
grid.setData(data);
183-
grid.once('onFirstUpdated', function() {
183+
grid.render();
184184

185-
const selector = `.${CONST.NS}`;
186-
const id = grid.id;
187-
const gridContainer = container.querySelector(selector);
185+
await delay();
188186

189-
assert.equal(gridContainer.classList.contains(id), true);
190-
assert.equal(gridContainer.getAttribute('id'), id);
187+
const selector = `.${CONST.NS}`;
188+
const id = grid.id;
189+
const gridContainer = container.querySelector(selector);
191190

192-
// console.log('onFirstUpdated before destroy');
193-
grid.destroy();
191+
assert.equal(gridContainer.classList.contains(id), true);
192+
assert.equal(gridContainer.getAttribute('id'), id);
194193

195-
assert.equal(document.querySelector(selector), null);
196-
assert.equal(container.innerHTML, '');
194+
// console.log('onFirstUpdated before destroy');
195+
grid.destroy();
197196

198-
// console.log('onFirstUpdated before done');
197+
assert.equal(document.querySelector(selector), null);
198+
assert.equal(container.innerHTML, '');
199199

200-
done();
200+
// console.log('onFirstUpdated before done');
201201

202-
// console.log('onFirstUpdated after done');
203-
});
204-
grid.render();
205202
});
206203

207204
it('Grid frozen check', function(done) {

0 commit comments

Comments
 (0)