Показать сообщение отдельно
Старый 16.07.2019, 01:15   #1  
Blog bot is offline
Blog bot
Участник
 
23,925 / 805 (74) +++++++
Регистрация: 28.10.2006
alirazazaidi: Change Text/BackGround Color Based Off Cell Value in Grid Dynamics 365 for finance and operations
Источник: https://www.tech.alirazazaidi.com/ch...nd-operations/
==============

Hi all, today I got opportunity to change color of Grid Cell based on some condition.

I achieved this by following code snippet.
First all I set Auto declaration to true of  required control in grid,
Second I add overwrite displayOption of grid data source.

This code snippet is interesting. It triggers for every row on grid.
And if you see below code snippet method signature shows the Common _Record. With this common _record, we can get current row of data source. And this we can apply some condition

Suppose we what to customer Name background to red who has credit limit is less then 1000  Following works

  public void displayOption(Common _record, FormRowDisplayOption _options)
        {

            CustTable custTable = _record as CustTable;


            if ( custTable.CreditLimit  < 1000)
            {

                _options.affectedElementsByControl(CustName.id());
                _options.backColor(WinApi::RGB2int(255,0,0));
                _options.textColor(WinApi::RGB2int(255,255,255));
            }
            super(_record, _options);


        }

Happy DAXing.


No more MVP


Источник: https://www.tech.alirazazaidi.com/ch...nd-operations/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.