danysion danysion - 1 year ago 168
Javascript Question

b:dataTable select a single row (and only a single one)

Good morning. I have a problem with my code in bootsfaces.
I need that my DataTable supports single row selection, but not multiple row selection. However, my table always uses only multiple selection.

This is my code:

<b:dataTable id="tableExpedients" fixedHeader="true" style="width:100%;"
pageLength="6" border="false" responsive="true" lang="es"
searching="true" var="exp" multiColumnSearch="true" paginated="true"
select="true" value="#{Expedients.getExpedients()}" custom-options="colReorder: true">

I do not get put simple selection, as I have referred these pages:



Thanks for all.

Answer Source

I've just implemented the option to limit row selection to individual rows. I'm not entirely sure if that's the bug you report, but now that's your personal feature :).

I didn't want to change the default values of BootsFaces, and I wanted to retain compatibility to PrimeFaces, so I decided to add a new attribute: selectionMode="single" switches the dataTable into the single row selection mode, similar to radio buttons. Please note that you still have to set select="true".

The new feature is going to be part of BootsFaces 1.0, which we plan to publish by the end of the month (October 2016). You can test it even earlier by following the instructions at https://github.com/TheCoder4eu/BootsFaces-OSP/issues/369.

Also see ticket 531 on our issue tracker.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download