MUI DataGrid 自定义单元格和 space 按钮
MUI DataGrid custom cells and space button
我有一个 DataGrid
自定义单元格是 TextField
组件。当我在 TextField
中输入内容时,它工作正常,直到我按下 space 按钮,而不是将 space 放在 TextField
中,它会将焦点更改到最后一行或只是什么也不做。有人可以帮忙吗?这是我的例子:https://codesandbox.io/s/cocky-currying-7du4sy?file=/src/App.js
将 stopPropagation()
添加到 onCellKeyDown
events
prop in DataGrid
.
赞为:
<DataGrid
...
onCellKeyDown={(params, events) => events.stopPropagation()}
/>
在你的例子中:
https://codesandbox.io/s/elated-dhawan-671nqb?file=/src/App.js
我有一个 DataGrid
自定义单元格是 TextField
组件。当我在 TextField
中输入内容时,它工作正常,直到我按下 space 按钮,而不是将 space 放在 TextField
中,它会将焦点更改到最后一行或只是什么也不做。有人可以帮忙吗?这是我的例子:https://codesandbox.io/s/cocky-currying-7du4sy?file=/src/App.js
将 stopPropagation()
添加到 onCellKeyDown
events
prop in DataGrid
.
赞为:
<DataGrid
...
onCellKeyDown={(params, events) => events.stopPropagation()}
/>
在你的例子中: https://codesandbox.io/s/elated-dhawan-671nqb?file=/src/App.js