jeudi 29 septembre 2011

How and When to use DisplayOption method on dataSource method

Use the colours in axapta grid is very useful and easy to implement in Microsoft Dynamics AX.


The way to do this, is overriding the displayOption method on the grid's form datasource.
Overriding this method, we can change the background colour and the text colour of the grid lines.
 
This is an example:
We want to paint the invoiced sales orders of SalesTable form in green.

We must override the displayOption method on the SalesTable datasource like this:

public void displayOption(Common _record, FormRowDisplayOption _options)
{
    SalesTable localSalesTable = _record;
    ;


    if(localSalesTable.SalesStatus == SalesStatus::Invoiced)
        _options.backColor(WinApi::RGB2int(50,255,50)); //Green


    super(_record, _options);
}

Aucun commentaire:

Enregistrer un commentaire