Skip to content

Commit 2e7f6b0

Browse files
committed
feat(QTable): Improve virtual-scroll event handling quasarframework#5494
1 parent d1cccee commit 2e7f6b0

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

ui/src/components/table/QTable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export default Vue.extend({
265265
type: '__qtable'
266266
},
267267
on: {
268-
'virtual-scroll': (e) => this.$emit('virtual-scroll', e)
268+
'virtual-scroll': this.__onVScroll
269269
},
270270
class: this.tableClass,
271271
style: this.tableStyle,
@@ -282,6 +282,10 @@ export default Vue.extend({
282282
header,
283283
this.getTableBody(h)
284284
])
285+
},
286+
287+
__onVScroll (info) {
288+
this.$emit('virtual-scroll', info)
285289
}
286290
}
287291
})

ui/src/components/table/QTable.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,39 @@
12791279
]
12801280
}
12811281
}
1282+
},
1283+
1284+
"virtual-scroll": {
1285+
"desc": "Emitted when the virtual scroll occurs, if using virtual scroll",
1286+
"params": {
1287+
"details": {
1288+
"type": "Object",
1289+
"desc": "Object of properties on the new scroll position",
1290+
"definition": {
1291+
"index": {
1292+
"type": "Number",
1293+
"desc": "Index of the list item that was scrolled into view (0 based)",
1294+
"examples": [ 30 ]
1295+
},
1296+
"from": {
1297+
"type": "Number",
1298+
"desc": "The index of the first list item that is rendered (0 based)",
1299+
"examples": [ 10 ]
1300+
},
1301+
"to": {
1302+
"type": "Number",
1303+
"desc": "The index of the last list item that is rendered (0 based)",
1304+
"examples": [ 50 ]
1305+
},
1306+
"direction": {
1307+
"type": "String",
1308+
"desc": "Direction of change",
1309+
"values": [ "increase", "decrease" ]
1310+
}
1311+
}
1312+
}
1313+
},
1314+
"addedIn": "v1.4.1"
12821315
}
12831316
},
12841317

0 commit comments

Comments
 (0)