Sfoglia il codice sorgente

single selection

tags/Baseline_180220205_Frontend
MSI\derek 10 mesi fa
parent
commit
54f5340ccc
1 ha cambiato i file con 9 aggiunte e 3 eliminazioni
  1. +9
    -3
      src/components/ProjectCashFlow/ProjectCashFlow.tsx

+ 9
- 3
src/components/ProjectCashFlow/ProjectCashFlow.tsx Vedi File

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

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


Caricamento…
Annulla
Salva