mardi 8 septembre 2020

How to prevent checkbox from converting to radio button when maxrowselection is 1 in salesforce lightning datatable

I have a lightning datatable using pagination(with 20 records on each page). For one particular case, client wants to be able to select bulk records spanned across multiple pages. As soon as the bulk records limit reaches, other records should be disabled. For this, I am using maxRowSelection attribute of datatable and changing it dynamically for each page depending on the bulk records limit and number of records selected. When the maxrowselection is changing to 1 for any particular page, checkbox for that page is converting to radio button.

I am facing following issues with converted radio button -

  1. Not able to deselect any row after it has been selected. ie, if bulk record selection limit is 40, and users have selected 39 records and moved to next page. Here user can select 1 record. Even after selection, he should be able to unselect it and select 1 record from next page. With radio button, user is not able to remove the selection unlike checkbox.
  2. UX is getting affected as users are getting checkboxes on some pages(where maxrowselection > 1) and radio buttons on other (where maxrowselection = 1)

Is there any workaround to stop this checkbox conversion?




Aucun commentaire:

Enregistrer un commentaire