Today I want to share with one way how you can highlight some Acumatica rows or data with colors or other text styles.
Disclaimer: Please note that this way does not follows the standard customization way, so any changes may be not supported in future versions of Acumatica. Also it might be very complex to support this customization during Acumatica upgrades.
Before we can change colors, first of all we need to do understand how Acumatica applies styles. Acumatica uses Cascade Style Sheets (CSS). All elements (Forms, Grids, Row, Fields, Buttons, …) are associated with one or many styles. All styles are defined in Acumatica folder itself
You can define styles in the CSS file itself or you also can apply it dynamically using ASPX Code Behind file:
Styles are associated with controls statically in control or page itself. During creation of HTML system will get associated style and sent it to the browser.
Fortunately you can change it dynamically too. If we want to change it depend on some parameters, we need to add our logic before HTML is generated. The best way is when data is already populated but HTML is still not generated – OnDataBound. In case we want to change styles for each separate grid row we can use grid row related event OnRowDataBound.
This event handler should be defined in ASPX.Code Behind file. There you can set styles dynamically and also you can control it depend on exact values. You can get all required data right from PXGridRowEventArgs, From this class you can get rows, cells and all other required information.
As i said in the article header these changes cannot be done with standard customization. If you change it in the page itself it might be very complex to update this customization later.
Here is full code snippet:
Have a colorful development!
Big thanks for Acumatica Customization team.