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(formDataSourceStr(JmgRegistrationTouchAssignedJobs, JmgJobTable), FormDataSourceEventType::DisplayOptionInitialize)]
public static void JmgJobTable_OnDisplayOptionInitialize(FormDataSource 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 FormDataSourceDisplayOptionInitializeEventArgs which we can use to set the color
Following is the complete code
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataSourceEventHandler(formDataSourceStr(JmgRegistrationTouchAssignedJobs, JmgJobTable), FormDataSourceEventType::DisplayOptionInitialize)]
public static void JmgJobTable_OnDisplayOptionInitialize(FormDataSource sender, FormDataSourceEventArgs e)
{
FormDataSourceDisplayOptionInitializeEventArgs fdsoption;
fdsoption= e as FormDataSourceDisplayOptionInitializeEventArgs;
fdsoption.displayOption().backColor(WinAPI::RGB2int(161,161,255));
}
Here is the result of my all efforts.
Support Faryal's Cusine