web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Controlling grid line colors

Sasha Nazarov Profile Picture Sasha Nazarov 901
Can see some folks have found the DisplayOptionInitialize event, still they are in doubt on how to control the displayOption settings based on the selected line.


Here is the solution:


X++:
 [FormDataSourceEventHandler(formDataSourceStr(Form1, SalesTable), FormDataSourceEventType::DisplayOptionInitialize)]
public static void SalesTable_OnDisplayOptionInitialize(FormDataSource sender, FormDataSourceEventArgs e)
{
FormDataSourceDisplayOptionInitializeEventArgs args = e as FormDataSourceDisplayOptionInitializeEventArgs;
RecId currentRecId = args.record().RecId;
int rgbValue = 255 - (20 * (currentRecId mod 2));
args.displayOption().backColor(WinAPI::RGB2int(rgbValue, rgbValue, rgbValue));
}


This was originally posted here.

Comments

*This post is locked for comments