primereact icon indicating copy to clipboard operation
primereact copied to clipboard

onSort return only one value on every event

Open maazcubix opened this issue 1 year ago • 2 comments

Describe the bug

<DataTable ref={dt} value={products} selection={selectedProducts} onSelectionChange={(e) => { if (Array.isArray(e.value)) { setSelectedProducts(e.value); } }} sortMode="multiple" dataKey="_id" lazy onSort={(e) => console.log(e)} onPage={onPageChange} first={first} paginator totalRecords={page?.totalDocs} rows={10} rowsPerPageOptions={[5, 10, 25]} paginatorTemplate=" PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" currentPageReportTemplate="Showing {totalRecords} products" globalFilter={globalFilter} header={header} selectionMode="multiple" > <Column selectionMode="multiple" exportable={false}></Column> <Column field="shortCode" header="ShortCode" style={{ minWidth: "12rem" }} ></Column> <Column field="name" header="Name" sortable style={{ minWidth: "16rem" }} ></Column> <Column field="image" header="Image" body={imageBodyTemplate} ></Column> <Column field="price" header="Price" body={priceBodyTemplate} sortable style={{ minWidth: "8rem" }} ></Column> <Column field="itemType" header="itemType" sortable style={{ minWidth: "10rem" }} ></Column> <Column body={actionBodyTemplate} exportable={false} style={{ minWidth: "12rem" }} ></Column> </DataTable> when the onsort function is enable it will return only one order value "1" on every click

Reproducer

No response

PrimeReact version

10.6.5

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

chrome

Steps to reproduce the behavior

No response

Expected behavior

the expected beahvoir would be orderby "1" and on another click the orderBy "0" for des

maazcubix avatar May 10 '24 15:05 maazcubix

Can you provide a stackblitz link please ?

Rekl0w avatar May 11 '24 07:05 Rekl0w

Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

github-actions[bot] avatar May 11 '24 11:05 github-actions[bot]