Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid saveAllEdits() keeps some editValues

    Hi
    I am currently enhancing ListGrid with edit functionality and we are getting warning messages about edited records lost from cache after we saveAllEdits:
    Code:
    [ERROR] [portal] - 13:33:35.688:XRP0:WARN:ListGrid:isc_ProviderAccountAccountingConfigurationListGrid__0:Record:{transactionCurrency: "EUR", providerAccountId: "954247380A0A227E01784911F6F938C2",
    merchantAccountPublicId: "000000315C1FBFAF"}, lost from local cache in paged result set. Pending edits for this record will be maintained.

    CONTEXT
    ----------
    I will simplify situation by presenting it to you as a PERSON grid.
    Columns are
    - NAME, AGE, SEX - composite primary key
    - PROFESSION (can be DEVELOPER or TESTER)
    - COUNTRY
    - CITY

    Editable columns are only COUNTRY and CITY, and they are dependent. If we change country, we will preselect capital city by default.
    And the new logic is when we change COUNTRY or CITY for record with PROFESSION TESTER, then we will find all other TESTERs in grid and change for them COUNTRY and CITY the same way.

    Code:
    +-------+-----+-----+------------+----------+--------+
    | NAME  | AGE | SEX | PROFESSION | COUNTRY  | CITY   |
    +-------+-----+-----+------------+----------+--------+
    | John  | 25  | M   | Tester     | Germany  | Munich |
    +-------+-----+-----+------------+----------+--------+
    | Clara | 27  | F   | Tester     | Germany  | Munich |
    +-------+-----+-----+------------+----------+--------+
    | Matus | 27  | M   | Developer  | Germany  | Munich |
    +-------+-----+-----+------------+----------+--------+
    USECASE:
    -----------
    Change country of John to France. City will get Paris preselected. John is tester, so this change will be applied to all testers: Clara will get France and Paris also.
    Asterisk shows that we have outstanding edit values:
    Code:
    +-------+-----+-----+------------+----------+--------+
    | NAME  | AGE | SEX | PROFESSION | COUNTRY  | CITY   |
    +-------+-----+-----+------------+----------+--------+
    | John  | 25  | M   | Tester     | *France  | *Paris |
    +-------+-----+-----+------------+----------+--------+
    | Clara | 27  | F   | Tester     | *France  | *Paris |
    +-------+-----+-----+------------+----------+--------+
    | Matus | 27  | M   | Developer  | Germany  | Munich |
    +-------+-----+-----+------------+----------+--------+
    If I call now getAllEditRows() and for all rows I will log getEditValues(), I will see:
    Code:
    Edit rows = 0,1
    0. {NAME=John, AGE=25, SEX=M, COUNTRY=France, CITY=PARIS}
    1. {NAME=Clara, AGE=27, SEX=F, COUNTRY=France, CITY=PARIS}
    2. {}
    Now I call saveAllEdits(). Update goes to server, refetch is triggered on the grid. The console gets warnings which I mentioned at the beginning and if I call again getAllEditRows() and getEditValues(), I see:
    Code:
    Edit rows = 1
    0. {}
    1. {NAME=Clara, AGE=27, SEX=F}
    2. {}
    John is saved completely, but Clara's primary key is still in the grid left as outstanding edit. How it is possible that we have pending edits after saveAllEdits()? Why it is the primary key values? I am investigating it since yesterday, trying to discard edits, change primary keys, clear grid data ... but nothing solves the problem completely.

    I know, you will ask for test case, but currently I was not able to run showcase locally because ... superdevmode is failing all the time. I would try again, if I will success I will post testcase additionally.

    Meanwhile, I will be glad if you get some help for me.
    Thanks
    Matus

    #2
    Probably a pretty straightforward issue: the warning message is telling you that the grid's data has been modified such that one of the edited records is no longer in the data set. So you are clearing the grid data, invalidating cache, changing criteria or similar while the grid has only processed *some* of the responses from the server that indicates saves were successful.

    Wait until the last response from the server has been processed before changing the grid's data.

    Comment

    Working...
    X