Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Inserting the record at the end of the grid

Posted on by Microsoft Employee

Hi All,

I have a grid on a form and when I press CTRL+N,I want the record to be inserted at the end of the grid but it goes back to the first record and insert the new record at the second position.

Then I wrote datasource_ds.last(); in create method of the datasource,so now when I press CTRL+N ,it inserts the record at the end of the grid first and then again if I press CTRL+N ,it inserts at the second row.

Hence first it inserts at end and then it inserts at second row position.

I am not sure how to fix this.

Also,insertatend property is yes.

*This post is locked for comments

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: Inserting the record at the end of the grid

    Hi Roshni,

    1.Data source InsertAtEnd property. You have already mentioned that you are Yes.
    2.When you currently add a new record, move the selected row of the cursor and add it again. Does the adding order change?

    I simply created a form and added data sources.

    My solution:
    Override the create() method in your datasource.

    public void create(boolean _append = true)
    {
       this.last();
       super(_append);
    }


  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Inserting the record at the end of the grid

    Actually there's a property called InsertAtEnd in the data source. Set that to yes.

  • Suggested answer
    BrandonSA Profile Picture
    BrandonSA 1,669 on at
    RE: Inserting the record at the end of the grid

    Hi Roshni

    On the datasource that your grid uses, there is a property called StartPosition. Change it to 'Last'.

    That means that all of the newest records will appear at the bottom, and the oldest ones at the top.

    You don't need any code for this requirement.

    Hope this helps

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans