Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Unanswered

Jump to a specific line/record in grid

Posted on by 543

Hi experts,

In Axapta 4.0, I have a grid with lines/records. The user can create records and change field values. When a field is modified, the form must change values on the current record and on some other records in the same form. And then it must refresh itself.

It works fine, except that when all that is done (from method modified() on the datasource field), then the form is refreshed and the focus jumps to the topmost record. (So for instance, when the user creates a record and enters 3 fields, then as the next field is modified, the cursor is suddenly on one of the old records and the new record is at the bottom of the grid.)

In order to simplify this, I have created a new table and a new form.

On the forms' classDeclaration, I have written this:
myTable myTableLocal;

On one of the form's datasource field, I have written this:

public void modified()
{
    ;

    super();

    myTable_DS.write();

    myTableLocal = myTable.data();

    myTable_DS.research(); // research and refresh are called from within the methods, my real program calls
    myTable_DS.refresh();

    if (myTableLocal.RecId)
    {
        myTable_DS.findRecord(myTableLocal);
    }
}

On the form's datasource, I have made this method:

public void executeQuery()
{
    ;

    super();

    if (myTableLocal.RecId)
    {
        myTable_DS.findRecord(myTableLocal); // just a test
    }
}

it works if I hard code it in executeQuery, but when it go through modified, it forgets that I have called findRecord.

I really hope, you can help!

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,835 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,526 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans