浏览代码

single selection

tags/Baseline_180220205_Frontend
MSI\derek 10 个月前
父节点
当前提交
54f5340ccc
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. +9
    -3
      src/components/ProjectCashFlow/ProjectCashFlow.tsx

+ 9
- 3
src/components/ProjectCashFlow/ProjectCashFlow.tsx 查看文件

@@ -72,11 +72,17 @@ const ProjectCashFlow: React.FC = () => {
); );


const handleSelectionChange = (newSelectionModel: GridRowSelectionModel) => { const handleSelectionChange = (newSelectionModel: GridRowSelectionModel) => {
var selection: GridRowSelectionModel = []
if (!isInitializing) { if (!isInitializing) {
setSelectionModel(newSelectionModel);
if (newSelectionModel.length > 1) {
selection = [newSelectionModel[1]]
setSelectionModel(selection)
} else {
selection = newSelectionModel
setSelectionModel(newSelectionModel);
}
const selectedRowsData = projectData.filter((row: any) => const selectedRowsData = projectData.filter((row: any) =>
newSelectionModel.includes(row.id)
selection.includes(row.id)
); );
const projectIdList = selectedRowsData.map((row: any) => row.id); const projectIdList = selectedRowsData.map((row: any) => row.id);
setSelectedProjectIdList(projectIdList); setSelectedProjectIdList(projectIdList);


正在加载...
取消
保存