Question Status

Muhammad Yasir asked a question on 5 Sep 2012 12:31 AM


I have a scenario in which i want to change the colour of the grid cell whenever i clicked/select that particular cell.The problem is that displayOption method of the datasource is not called when i select that cell.I do not know how to call the DisplayOption method manually.

DisplayOption method takes two arguments.

1. Record

2 FormRowDisplayOption (object)

The problem is that i dont know how to initialize and pass the second argument that is FormRowDisplayOption to the displayOption method.and whether tsome properties needs to be set for the object before passing to the method.

Please give me any solution if any one knw it.

Muhammad Yasir

Martin Dráb responded on 6 Sep 2012 2:15 PM

It seems impossible to create a FormRowDisplayOption in custom code. But maybe you could get the instance when displayOption() is called by AX kernel for the given record, save it to a variable and use it for your purposes.

Muhammad Yasir responded on 7 Sep 2012 12:22 AM

Thanks Martin for your prompt reply, as you have said that i can get the instance when displayOption() is called by AX kernel for the given record, the problem is when i click a particular cell of grid displayOption() is not called automatically, so forcefully i have to call the displayOption() method manually, but i don't know how to correctly pass the object of FormRowDisplayOption as argument to the displayOption() method.

i have tried the following code in the enter() method, but i got an error,

FormRowDisplayOption  obj = new FormRowDisplayOption();


FormDatasource.displayOption(Record, obj);

Here is the error:

Error executing code: Object object does not have method 'backColor'.

Is there any solution.


Martin Dráb responded on 7 Sep 2012 3:06 AM

I understand the problem and I wrote that I think that you can't construct FormRowDisplayOption by yourself. But you can store the FormRowDisplayOption instance created by AX kernel and try to use the same instance in subsequent calls.

Muhammad Yasir responded on 7 Sep 2012 5:07 AM

I have tried what you have suggested, i successfully store the FormRowDisplayOption instance created by AX kernel,but in doing so another problem arises that is the record that i pass to the displayOption() method will not be highlighted in the grid,It will highlight only that record in the grid that is first used ie. when the form loads and at that moment a record is in memory so it will highlight that record.

hope you have understand the scenario

Any solution for this as well, i appreciate your for the prompt response,



shankarkovvui responded on 10 May 2014 4:08 AM

you can try research(true) in active method.

Martin Dráb responded on 11 May 2014 8:20 AM

research(true) in active()? I would expect the following outcome: active calls research(true), which research the data source and activate the record, which executes research(true) again and so on and so on. In other words: an infinite loop.

Palle Agermark responded on 12 May 2014 1:23 AM

If you don't have too many records to work with, you could consider using a FormTableControl rather than the Grid control. That will of course give you some more work with the data bindings.

I have myself given up on figuring out how to color individual cells in a grid.