Skip to content
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

DataTable: conditional row reorder shows "false" instead of hiding reorder icon #4854

Closed
gonzaloarca opened this issue Aug 31, 2023 · 3 comments · Fixed by #4856
Closed

DataTable: conditional row reorder shows "false" instead of hiding reorder icon #4854

gonzaloarca opened this issue Aug 31, 2023 · 3 comments · Fixed by #4856
Assignees
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@gonzaloarca
Copy link

gonzaloarca commented Aug 31, 2023

Describe the bug

I'm attempting to use the showRowReorderElement prop in the DataTable component, and in those cases where the RowReorderElement should be hiding, it renders a false text instead.

On a side note, is it possible to provide a fallback component for the column in those cases where the showRowReorderElement function evaluates to false?

Here's an image of what the rendered table looks like in the aforementioned column.
image

Reproducer

CodeSandbox

PrimeReact version

9.6.0

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Use the DataTable component with the showRowReorderElement function, and a column with the rowReorder prop set to true
<DataTable
      value={rows}
      reorderableRows
      showRowReorderElement={data => showReorder(data)}
      onRowReorder={handleDragEnd}
>
      <Column header='' rowReorder style={{ width: '3rem' }} />
      <Column
	      header='#'
	      headerStyle={{ width: '3rem' }}
	      body={(data, options) =>
		....
	      }
      />
</DataTable>

Expected behavior

I expected the row that makes the showRowReorderElement evaluate to false to be hidden, instead of rendering false

@gonzaloarca gonzaloarca added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 31, 2023
@akshayantony55
Copy link
Contributor

Can you add a repro link (sandbox) to the issue? @gonzaloarca

@gonzaloarca
Copy link
Author

@akshayantony55 done

@ubau
Copy link

ubau commented Sep 1, 2023

To get rid of false simple workaround is:

showRowReorderElement={(data) => data.showReorder ? data.showReorder : ""}

@melloware melloware added Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 1, 2023
melloware added a commit to melloware/primereact that referenced this issue Sep 1, 2023
@melloware melloware self-assigned this Sep 1, 2023
@melloware melloware added this to the 10.0.0 milestone Sep 1, 2023
@melloware melloware modified the milestones: 10.0.0, 9.7.0 Sep 1, 2023
@melloware melloware modified the milestones: 9.7.0, 10.0.0 Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants