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: rowStyle function doesn't work #3738

Closed
vaiil opened this issue Mar 10, 2023 · 2 comments
Closed

DataTable: rowStyle function doesn't work #3738

vaiil opened this issue Mar 10, 2023 · 2 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@vaiil
Copy link

vaiil commented Mar 10, 2023

Describe the bug

According to the docs:
rowStyle is a function that takes the row data as a parameter and returns the inline style for the corresponding row.

But if we look at code, we see that it accept only object. There were an issue before, but it wasn't fixed.

Reproducer

https://codesandbox.io/s/funny-noyce-90zjm0?file=/src/App.vue

PrimeVue version

3.24

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to sandbox

Expected behavior

rowStyle function should be called, its result should be used as a style of row

@vaiil vaiil added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 10, 2023
@tugcekucukoglu tugcekucukoglu self-assigned this Mar 13, 2023
@tugcekucukoglu tugcekucukoglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Mar 13, 2023
@tugcekucukoglu tugcekucukoglu added this to the 3.24.1 milestone Mar 13, 2023
@tugcekucukoglu tugcekucukoglu removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 13, 2023
@tugcekucukoglu tugcekucukoglu changed the title rowStyle function doesn't work DataTable: rowStyle function doesn't work Mar 13, 2023
@Rakasch
Copy link
Contributor

Rakasch commented Mar 21, 2023

Oh wow. That "fix" just broke my datatable.
All rows vanished. Took me quite some time to find the root cause, since there was no error shown, just an empty body tag.

I had an inline
:rowStyle="'height: ' + itemSize + 'px'"
This does not work anymore.

Had to change it to
:rowStyle="rowStyle"
Where rowStyle is a function that returns the string.

@pyramid-johng
Copy link

actually rowStyle et al take "objects" (it parses them) not strings so you should have had {'height': itemSize + 'px'} as the value you omitted the curly braces indicating an object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

4 participants