Grid/List row color change using method override D365
Today, I received the requirement from my functional to change the row color Grid/List page on any specific condition...
As we all knows in custom form its really easy to achieve but in my case I need to do this on exists form using method override/Event handler of Data source..
So I start searching over internet and community and found that lots of people were facing the same issue because this feature is not available in extension...
After the resolution of this task i decide to share with everyone..
There is an event available in data source OnDisplayOptionInitilized. I copied the event handler and paste on my class.
Following are the code
[FormDataSourceEventHandler(fo rmDataSourceStr(JmgRegistratio nTouchAssignedJobs, JmgJobTable), FormDataSourceEventType:: DisplayOptionInitialize)]
public static void JmgJobTable_ OnDisplayOptionInitialize(Form DataSource sender, FormDataSourceEventArgs e)
{
}
Now another challenge is ready for me to find the display Option and set the back-ground color..
After one hour of efforts found a class FormDataSourceDisplayOptionIni tializeEventArgs which we can use to set the color
Following is the complete code
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataSourceEventHandler(fo rmDataSourceStr(JmgRegistratio nTouchAssignedJobs, JmgJobTable), FormDataSourceEventType:: DisplayOptionInitialize)]
public static void JmgJobTable_ OnDisplayOptionInitialize(Form DataSource sender, FormDataSourceEventArgs e)
{
FormDataSourceDisplayOptionIni tializeEventArgs fdsoption;
fdsoption= e as FormDataSourceDisplayOptionIni tializeEventArgs;
fdsoption.displayOption(). backColor(WinAPI::RGB2int(161, 161,255));
}
Here is the result of my all efforts.