In Budget Analysis form, When we open the form it shows list of projects on left side grid. Then when we select value on left side grid then only the Grid on Right hand side is getting filled. If I have only one project on Left hand side, is there any way i can get right hand side grid populated for that project at the time when i open the form??
I tried bringing the code from selection changed method of lefthand side grid to init method of form, but i am getting some difficulty with tree nodes etc.
Can someone suggest me a best way to do this?
I would suggest the following two changes for version AX 2012 R3. I would guess that this would also work in other AX 2012 versions. I could not find any budget analysis in AX 2009 and I doubt it exists there because it is part of the retail module which has been introduced in AX 2012.
First, customize the building of the tree control such that the first child will get selected instead of the root. To do that, customize method initTreeControl
of class BudgetAnalysisInquiryHelper_PSN
and add the following line after the tree has been expanded:
_formTreeControl.select(_formTreeControl.getChild(_formTreeControl.getRoot()));
Now that the correct node in the tree is selected, the getBudgetSummary
method of form BudgetAnalysisInquiry_PSN
can be called to update the grid. To do this after the form has been opened, put the following lines at the end of method run
(basically the same lines as in method selectionChanged
of the tree control):
selectedNode = ctrlDimensionTree.getItem(ctrlDimensionTree.getSelection());
budgetAnalysisDimensionNode = selectedNode.data();
ctrlSelectedNode.text(budgetAnalysisDimensionNode.getNodeText());
element.getBudgetSummary(ctrlDimensionTree);
Calling these lines in method init
is too early because method run
(which is executed after init
) calls method refreshGrids
which deletes the data in the temporary data sources of the form.