change grid row color in listpage form

Hi AX guys,

I need to change the grid row’s color if certain conditions are met. The usual solution for this is to override the formdatasource method displayoption(). However, the form is listpage type and the customization works only in the interaction class (AX 2012). How can i do this task in AX2012? I am trying to have the code below to override the displayoption method, but nothing happen.

[FormDataSourceInteractionAttribute(‘ReqPO’, ‘displayOption’)]

public void reqPO_DS_displayOption( Common _p1 = null,

FormRowDisplayOption _option = new FormRowDisplayOption())

{

//some code to do the coloring of grid’s row;

}

Hope any guys from AX world can help me with this.

Cheers!

Hi,

[FormDataSourceInteractionAttribute(‘ReqPO’, ‘displayOption’)]

public void reqPO_DS_displayOption( Common _p1 = null,

FormRowDisplayOption _option = new FormRowDisplayOption())

{

// Use the following code

if(condition)

{

_options.backColor(WinApi::RGB2int(64,128,128);); // For red color, user other color combination for different colors.

}

}

Hope this helps.

Regrads,

Raghav.

Hi Raghav,

Thanks for the reply, but that lines of code will work inside the displayoption method of the form datasource. This is the problem I am facing now, I cannot override the displayoption method of the form since the form is a listpage. By the way, I’m working with AX 2012.

Thanks,

Freya

try to change the DisplayTarget property if you are not using the object in Enterprise portal, so that it will allow you to override the methods, so that you can add your own code.

Hi Ven,

The datasource dont have that property. I think that property will work under design node.

Thanks.

Hi Frea,

Did you get the solution for changing colors in grid of List page.

If yes then please let me know, or else do you have any suggestions to achieve this.

Regards,

Vijay Solanki.

Hi Frea,

I am also facing same problem. Did you get any solution for your problem then please let me know…

Regards,

Sumit

Hi Frea,

I use the following code on standard form, I suppose it works on listpage forms, Just add a displayOption method on your form datasource, it changes line color if some conditions are met.

public void displayOption(Common _record, FormRowDisplayOption _options)
{
YourCurrentTable YourCurrentTable = _record;
YourOtherTable YourOtherTable;
;
select firstonly YourOtherTable where YourOtherTable.yourOtherField == YourCurrentTable.yourCurrentField;

if(YourOtherTable.yourOtherField)
{
_options.backColor(WinApi::RGB2int(50,255,50));
}

super(_record, _options);
}

Hope it helps, please verify answer if it solves your problem

regards,

Thomas

Hi Thomas,

I am not able to add methods in Standard Forms Datasource, but I tried this on Query datasource, which is use for that form. But it is not working. Do you have any suggestion, please let me know.

regards,

Sumit

Hi Sumit,

I’m sorry but I don’t know yet how to or if it’s possible to use displayOption() method on form Query datasource, I had a look to StackOverflow forum and found nothing

Please let me know if you find a solution

regards,

Thomas

Did anyone found solution for this?

Hello,

I hade done the same but I have error of type:

Internal error 25 in script

do you have any idea of what causes the problem and potentially the solution?

Hello Tomas,

Would you like to tell me if you have encounter that kind of problem:

internal error 25 in script

thank you so much in advance

HI Widad,

I’m using AX 2009 and I never had the error you mentionned, I found informations in the following link but didnt’t tested

http://blogs.msdn.com/b/mfp/archive/2011/05/27/quot-internal-error-25-quot-causes-and-solutions.aspx

regards,

Thomas

Dear Frea,

Hope you are doing excellent,

Did you find any answer about coloring of record in list page.

Thanks in advanced…[:)]

FYI

http://thedynamicsblog.com/alternate-of-displayoption-method-on-list-page/