javascript - 反应虚拟化的箭头键步进表
问题描述
我的问题出在 ArrowKeyStepper 中。它不适合我。我尝试按下键盘按钮,但没有任何效果。链接到此处的文档react-virtualized
<ArrowKeyStepper
columnCount={1}
rowCount={data.length}
mode="cells"
>
{({ onSectionRendered, scrollToRow }) => {
return (
<Table
onRowsRendered={({ startIndex, stopIndex }) => {
onSectionRendered({
rowStartIndex: startIndex,
rowStopIndex: stopIndex
});
}}
scrollToRow={scrollToRow}
rowCount={data.length}
rowGetter={({ index }) => data[index]}
>
// Column here
</Table>
);
}}
</ArrowKeyStepper>
我试图找到答案,但没有奏效。
解决方案
使用 Table,您可以尝试使用 scrollToIndex,然后传递表项的索引,而不是使用 ArrowKeyStepper。
const {index} = this.props
return (
<Table
onRowsRendered={({ startIndex, stopIndex }) => {
onSectionRendered({
rowStartIndex: startIndex,
rowStopIndex: stopIndex
});
}}
scrollToRow={scrollToRow}
rowCount={data.length}
rowGetter={({ index }) => data[index]}
scrollToIndex={index}
>
// Column here
</Table>
);
推荐阅读
- macos - 在 Mac 上使用 VS 2019 生成的 docker compose 文件时出现问题
- c# - Blazor 输入掩码
- python - 未找到 Kivy 的模块
- python - 使用列表在python中创建数字网格
- apache-kafka - Kafka 服务器未与 Zookeeper 服务器远程连接
- c - 出现几个 CMake 错误
- python - 在 PyCharm 中找不到 PyQt5
- git - 关闭终端窗口后Git合并获取源分支名称
- flutter - Dart/Flutter ffi(外部函数接口)本机回调,例如:sqlite3_exec
- azure-devops-rest-api - Azure DevOps Server 2019 以编程方式复制测试用例错误异常:'TF237124:工作项未准备好保存'。”