web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to make grid list's cursor on the 1st row

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I'm creating a form displaying a grid list. The normal display will be as the initial index table, so will be in ascending order. I would then make it Descending and save it as NewView. Question is what is the best way to make the cursor will automatically placed on the 1st row ? (which mean by the descending order of my saved view, will be the latest/biggest index number)

Should I do it programmatically in X++, where and how ?

Thanks,

I have the same question (0)
  • Verified answer
    Anton Venter Profile Picture
    20,635 Super User 2026 Season 1 on at

    You can change the sorting in the init() method of the datasource in question, see my example below. The selected row is now at the top of the grid, the first row.

        [DataSource]
        class CustTable
        {
            public void init()
            {
                super();
    
                QueryBuildDataSource qbds = this.query().dataSourceNo(1);
                qbds.clearSortIndex();
                qbds.addSortField(fieldNum(CustTable, AccountNum), SortOrder::Descending);
            }
        }

  • VoltesDev Profile Picture
    on at

    Hi Anton,

    Thanks so much. Just for learning, may I know also if there is a way on the UI side? I mean can the UI front-end also cater this ? since I found many people using this SaveAs View for their own personalize, when they change the column to be descending, it will display as descending but the row will point to the 1st record way down if we have a lots of record.

    Thanks

  • Anton Venter Profile Picture
    20,635 Super User 2026 Season 1 on at

    You can use the positionToRecord() datasource method passing the buffer of the record you want to be selected.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, You can check StartPosition Property of Form Root DataSource. It determines whether the first or the last record should be the current one when the form opens.

    If the property is set to First, even if user change the form to Descending based on a field and create a Saved view. On opening the view, it should be first record opened (As per applied sorting on field).

    learn.microsoft.com/.../form-data-source-properties

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 521 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 438

#3
Adis Profile Picture

Adis 261 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans