Refresh entire form in AX 2012?
Asked Answered
M

2

7

I'm currently working with a form that has a grid at the bottom. Whenever I hit f5, the grid refreshes, but the rest of the form does not. What can I do to make the entire form refresh it's data?

Thanks.

Monoclinous answered 3/10, 2012 at 13:57 Comment(0)
J
4

You may override the research method on a datasource:

public void research(boolean _retainPosition = false)
{
    super(_retainPosition);
    other_ds.research(_retainPosition);
}

The other_ds is a datasource not joined by the current datasource.

Jagir answered 4/10, 2012 at 8:48 Comment(2)
Isn't refresh called in AX 4.0 but in AX 2009/2012 research is called when F5 is clicked, and refresh is triggered by Ctrl+F5?Billetdoux
Mine didn't require using another datasource but this got me on the right track by overriding research method. Had a modified method on my item id lookup that I added to the research and it works now! Thanks!Monoclinous
B
3

It depends on the form you are working with. When you hit F5 on a record, it runs the research method on the datasource the record belongs to or its parent datasource (depends on the form's query, e.g. if you hit F5 on SalesLine in the SalesTable form, SalesTable_ds.research(true) will be run). As I see it, if the rest of your form displays fields that belong to these datasources then these fields will be updated. If the fields do not belong to these datasource the rest of your form will not be updated (unless e.g. the active method has been overridden to refresh the rest of the form from the code.

What you can do to make the entire form refresh its data when F5 is hit: again, it depends on the form, so not knowing all the details it is difficult to advise something, but one of the things you can do is override the research method on your datasource and refresh the rest of the form programatically from there. It is more common to override the active method, you should normally go for it.

Billetdoux answered 4/10, 2012 at 9:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.