Dynamic bodyClass for DataTable Column

UI Components for Vue
Post Reply
Posts: 24
Joined: 11 Jan 2022, 10:54

07 Aug 2022, 20:24

I need to set the background color of a DataTable Column (bodyClass) based on a property of the row data. Is there any way to achieve this?

As a workaround, I can set a fixed height in the body template of the column, but the I get into trouble with the responsiveness.

Posts: 440
Joined: 23 Oct 2020, 09:28

11 Aug 2022, 16:14

Could you please check this example https://codesandbox.io/s/mnvnsc?file=/s ... ue:283-339, especially 'Quantity' column.


Posts: 24
Joined: 11 Jan 2022, 10:54

11 Aug 2022, 16:25

Thanks for the example and the reply. However, I would like to apply the class (dynamically) to the <td> element and not the content.

Posts: 3
Joined: 21 Dec 2020, 13:26

23 Aug 2022, 07:59

Thanks for the reply @tugce.kucukoglu.
I was exactly looking for the :rowClass feature to dynamically style rows, depending on the {data}.

Made my day

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest