OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums OroPlatform OroPlatform – How do I? Questions add css class to report rows or cells

This topic contains 5 replies, has 4 voices, and was last updated by  farzam.sabeti 1 week, 6 days ago.

  • Creator
    Topic
  • #36189
    Ahmad Golzar
    Ahmad Golzar
    Participant

    Hi,

    Is it possible to add css class to report grid rows or cells based on condition check? We need to check a condition and for example set background color for rows.

    Any suggestion?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #36190
    Yevhen Shyshkin
    Yevhen Shyshkin
    Moderator

    Hello.

    The easiest way to do that is to pass column called “row_class_name” to frontend – in this case this column value will be added to grid row class, so you can apply your own styles to this row. If you need to apply this styles to some specific grid – you can write it right into grid configuration, if no – you need to listen to datagrid event (probably, PreBuild) and alter grid configuration there.

    Example:

    And result:

    If you need to do something more sophisticated that includes JS code – you should add JS datagrid builder and customize grid from frontend side there (example of datagrid builder module).

    #36191
    Ahmad Golzar
    Ahmad Golzar
    Participant

    Dear Yevhen,

    Thank you so much for your perfect reply. The “row_class_name” solution is exactly what we were looking for and should cover our needs.

    Thanks again,
    Ahmad

    #38780

    farzam.sabeti
    Participant

    Hi

    I was looking to add css class to report grid rows based on condition check in oro version 3.1. I did what you said but, that did not work. I expected to see the class name on the <tr> … </tr> tag but, nothing happened.

    Can you please guide me?

    Thanks

    #38793
    Hryhorii Hrebiniuk
    Hryhorii Hrebiniuk
    Participant

    Hi,

    Turned out, there’s bug. We’ll fix it.

    Here’s patch that fixes the issue:

    #38815

    farzam.sabeti
    Participant

    That works correctly. Thank you so much.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No