microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
733 stars 243 forks source link

CurrPage.Update(false) does not refresh listpage correctly. #6478

Closed jvak closed 3 years ago

jvak commented 3 years ago

Describe the bug The list page does not refresh correctly when using CurrPage.Update(false) if you change the field in code on which the listpage is sorted , e.g. by using custom developed actions on the page like moveup / movedown. It seems that integer/decimal fields in the list are not refreshed, in contrast to other fields. See the screen recording in attachment. This has been tested on the latest sandbox environment.

To Reproduce Steps and to reproduce the behavior: Screen recording:

Edit - General Journals - Dynamics 365 Business Central.zip

AL Code to reproduce the issue Here you can find the page extension for the general journal page with the sorting set and the moveup - movedown actions:

pageextension 71000 "NVT General Journal Ext" extends "General Journal" { actions { addlast(processing) { action("NVT MoveUp") { ApplicationArea = All; Caption = 'Up'; Image = MoveUp; Promoted = true; PromotedCategory = Process; PromotedOnly = true;

            trigger OnAction()
            begin
                MoveUp();
            end;
        }
        action("NVT MoveDown")
        {
            ApplicationArea = All;
            Caption = 'Down';
            Image = MoveDown;
            Promoted = true;
            PromotedCategory = Process;
            PromotedOnly = true;

            trigger OnAction()
            begin
                MoveDown();
            end;
        }
    }
}

trigger OnOpenPage()
begin
    Rec.SetCurrentKey(Amount);
end;

var
    JournalLine: Record "Gen. Journal Line";

local procedure MoveUp()
begin
    JournalLine.Copy(Rec);
    JournalLine.Get(Rec."Journal Template Name", Rec."Journal Batch Name", Rec."Line No.");
    if JournalLine.Next(-1) <> 0 then begin
        JournalLine.Amount := JournalLine.Amount + 1;
        JournalLine."Amount (LCY)" := JournalLine."Amount (LCY)" + 1;
        JournalLine.Modify();

        Rec.Amount := Rec.Amount - 1;
        Rec."Amount (LCY)" := Rec."Amount (LCY)" - 1;
        Rec.Modify();

        CurrPage.Update(false);
    end;
end;

local procedure MoveDown()
begin
    JournalLine.Copy(Rec);
    JournalLine.Get(Rec."Journal Template Name", Rec."Journal Batch Name", Rec."Line No.");
    if JournalLine.Next() <> 0 then begin
        JournalLine.Amount := JournalLine.Amount - 1;
        JournalLine."Amount (LCY)" := JournalLine."Amount (LCY)" - 1;
        JournalLine.Modify();

        Rec.Amount := Rec.Amount + 1;
        Rec."Amount (LCY)" := Rec."Amount (LCY)" + 1;
        Rec.Modify();

        CurrPage.Update(false);
    end;
end;

}

Expected behavior The entire listpage should be correctly refreshed, displaying the correct information in all lines and columns.

Screenshots Initial state before pressing action. List is sorted on column. image

after pressing action: image

After manually focusing on the amount field in the previous line, the amount fields are the correctly refreshed. image

5. Versions:

dzzzb commented 3 years ago

It seems that integer/decimal fields in the list are not refreshed, in contrast to other fields.

Do you mean that changing e.g. text fields, such that a different sort order would result, does cause reordering upon CurrPage.Update()?

jvak commented 3 years ago

@dtkb Reordering works fine, only the values in some integer/decimal columns of the previous record are not refreshed correctly until you manually put your cursor in those fields.

PooyaKharamesh commented 3 years ago

Let's get the issue to a team who will fix and backport it, as this repository is only for issues related to the latest developer preview environment for Dynamics 365 Business Central. We suggest that you open a support case or file a bug in Collaborate, to ensure that all Business Central users benefit from your catch as soon as possible.

To open a support case, you can:

If you file the bug in Collaborate, remember to include steps to reproduce the issue, and the Business Central build number and country version you're using.

srinivasbanny commented 1 year ago

@jvak may i know what is the resolution for this ? i am also facing same sort of issue

mumarkhann commented 2 months ago

I am facing this issue as well, any solution to this?