简体   繁体   中英

Dynamics AX 2009: Go to Main Table Form - How to select the default row?

I am overriding the jumpRef method on a drop down control in the design on my Form. Below is the code from that method. Currently, it shows the Form for the table with all rows visible. So far so good, however, I would like the specific row that had been selected on the initiating Form to be highlighted on the new Main Table Form when it displays.

public void jumpRef()
{
   ReasonTable     reasonTable;
   Args            args;
   MenuFunction    menuFunction;
   ;

   // Use whole table (i.e. No filtering, show all rows)
   reasonTable = ReasonTable;

   // Establish this form as the caller
   args = new Args();
   args.caller(element);

   // Create a new MenuFunction that launches the Reasons Menu Item
   menuFunction = new MenuFunction(
       menuitemdisplaystr(Reasons),
       MenuItemType::Display);
   menuFunction.run(args);
}

After some more experimentation, I was able to find the answer. Adding this line solved my dilemma:

args.lookupRecord(reasonTable::find(this.text()));

It did exactly what I was hoping to accomplish. I tried this before, but couldn't figure out what object/value to put into the method.

args.record(reasonTable); - if reasonTable is used to identify the record for positioning

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM