Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
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.
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.Thnaks.Muhammad Yasir
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.
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();
Here is the error:
Error executing code: Object object does not have method 'backColor'.
Is there any solution.
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.
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,
you can try research(true) in active method.
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.
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.