DataTable's checkbox selection has different behavior in PrimeReact 6

UI Components for React
Post Reply
LarryCapija
Posts: 2
Joined: 03 May 2021, 10:36

03 May 2021, 10:50

Code: Select all

                    <DataTable value={this.state.products} selection={this.state.selectedProducts3} onSelectionChange={e => this.setState({ selectedProducts3: 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>
In V4 and V5 you had to click on the actual checkbox to make a selection. Clicking anywhere else in the row triggered no action. This is desirable in case user wants to highlight text for copy /paste.
https://www.primefaces.org/primereact/v ... /selection

On the other hand, in V6, clicking anywhere on the row triggers a selection. Making it imposible to highlight text without triggering a row selection.
https://primefaces.org/primereact/showc ... /selection

Is there a way to have a multiple Checkbox-Only Selection in v6?

mert.sincan
Posts: 4710
Joined: 29 Jun 2013, 12:38

07 May 2021, 00:47

Hi,

Yes, you can use selectionMode="checkbox" for it.

Exp; https://primefaces.org/primereact/showc ... /selection

Best Regards,

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests