Davit
Davit

Reputation: 362

Dynamically reload a table in a form programatically

I have a form in Dynamics AX which displays a table of two columns in a grid. I also have a button on the form. I am overriding the clicked method of the button to update the Address field of the table. For example, here's my X++ code:

void clicked()
{
    AddressTable addr;    
    ttsBegin;
    select forUpdate addr where addr.addressID == 1;
    addr.Address = "new address";
    addr.update();
    ttsCommit;
    super();     
    // reload table here
}

What I would like to do is to add a code to the clicked function which will reload (re-select) the updated records and show them in the form without a need of reopening the window or refreshing it using F5 (for example).

I went through forums and AX documentation and found a few methods like refresh and reread, but they are FormDataSource class methods and I failed to make it happen inside the clicked handler above.

So, what I really want to accomplish programaticallyis what F5 does behind the scenes when clicked on an open form.

Upvotes: 0

Views: 2770

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

Maybe just addressTable_ds.research(true); will do the job.

See also Refresh Issue on the form when the dialog closes.

Upvotes: 2

Related Questions