Tuesday 16 May 2017

Change the color of single column in AX 2012


Override the displayOption() method of the form's datasource 
to change appearance of any row in the grid. You can set either the 
foreground or the background color of the row.


public void displayOption(Common _record, FormRowDisplayOption _options)
{
   _options.backColor(WinApi::RGB2int(0,255,0)); 
} 

For highlighting one or more cells, override the 

To highlight one or more individual cells, use 
the ._options.affectedElementsByControl() method. 

public void displayOption(Common _record, FormRowDisplayOption _options)
{
  _options.backColor(WinApi::RGB2int(0,255,0));
  _options.affectedElementsByControl(Control1.id());
  _options.affectedElementsByControl(Control2.id());
} 

You can change multiple cells this way but you cant 
assign different colors to different cells. You have to use only one 
color for any of the cells in the row.

No comments:

Post a Comment