Tuesday, 3 March 2015

How to Color grid in ax 2012

In this post you can find how to color a grid on specific value or condition

On your form override a method on form datasource called

DisplayOption()

Now write code on displayOption Method.

public void displayOption(Common _record, FormRowDisplayOption _options)
{
A_Table1_1      A_Table_Local;
A_Table_Local = _record;

    if(A_Table_Local.AccountNum == '1' || A_Table_Local.AccountNum == '5')
    {
        _options.backColor(65408); //Light Green
        _options.affectedElementsByControl(A_Table1_1_AccountNum.id());
      // the code is for cell specific coloring
    }
    else
    {
        _options.backColor(6029311); //Light Yellow
        _options.textColor(12582912); //Blue
     // for row color
    }
}

Done....!!!!

No comments:

Post a Comment