When selectionMode of both DataTable and Column is "multiple", DataTable acts as "single" selection mode
I'm submitting a bug
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57
Codesandbox Case (Bug Reports) https://codesandbox.io/s/primereact-test-jjccq?file=/src/index.js
Current behavior When selectionMode of both DataTable and Column is "multiple", DataTable acts as "single" selection mode. Multiple rows cannot be selected.
Expected behavior Multiple rows can be selected.
Minimal reproduction of the problem with instructions
DataTable selectionMode="multiple" Column selectionMode="multiple"
Please tell us about your environment: Windows 10
-
React version: 16.13.1
-
PrimeReact version: 4.2.2
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] All
-
Language: [all | TypeScript X.X | ES6/7 | ES5]
Actually it's not working as single selection mode. It's working with metaKey. It means if you give DataTable selectionMode="multiple", you can use multiple selection with cmd on macOs or ctrl on Windows. If you don't wanna use metaKey and just select with a click, you should simply add DataTable metaKeySelection={false}. Like this ;
<DataTable metaKeySelection={false} selectionMode="multiple" value={products} selection={selectedProducts3}
onSelectionChange={e => setSelectedProducts3(e.value)} dataKey="id">
<Column selectionMode="multiple" headerStyle={{width: '3em'}}></Column>
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
<Column field="quantity" header="Quantity"></Column>
</DataTable>
Hi,
I added rowSelectionMode property to DataTable. https://github.com/primefaces/primereact/issues/1926
Please use the following code after the new version is released;
<DataTable rowSelectionMode="add" ...>
<Column selectionMode="multiple" ....>
// other columns
</DataTable>
Best Regards,