New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selecting single record #112
Comments
Not at the moment. |
How about this? const [selectedRecords, setSelectedRecords] = useState([]);
<DataTable
selectedRecords={selectedRecords}
onSelectedRecordsChange={setSelectedRecords}
isRecordSelectable={(record) => record == selectedRecords[0] || selectedRecords.length < 1}
/> Or for any const n = 12;
<DataTable
{/* ... */}
isRecordSelectable={(record) => selectedRecords.includes(record) || selectedRecords.length < n}
/> |
A property I would still go ahead with checkbox and removing checkbox from the header field. |
@ShahriarKh thanks for the suggestion. But, unfortunately this doesn't serve the purpose. I tried this. Still I could select multiple items by clicking header checkbox. Also, this requires me to uncheck the selected record every time before checking the new record. For now, I use this workaround:
|
I think if you are only able to select one row then a radio would be more clear. But I think making that configurable (with radio as default) would be ideal. |
Hi, does community feel this feature is important and is it planned sometime in near future? If not, I don't mind closing this issue. |
Single record selection clicking on line is really cool. |
@russocorp You can easily get the record data of a clicked row with |
In the end, since this is really an edge case, I'd suggest using a custom column with a |
I know that, but after click, line dont have a diferent background or something like that. |
@russocorp Since you'll have to manage the selected row in your state anyway, you could easily apply your own particular style to it: https://icflorescu.github.io/mantine-datatable/examples/additional-styling#row-styling |
Is your feature request related to a problem? Please describe.
Currently, the way of selecting records allows for multiple record selection. Is there out-of-the-box way to restrict selection to single record only?
The text was updated successfully, but these errors were encountered: