Visual Builder

Get Involved. Join the Conversation.

Topic

    Stephen Bryant
    State Management with a Data Grid ** Need Advice***
    Topic posted July 19, 2019 by Stephen BryantBronze Trophy: 5,000+ Points, last edited July 20, 2019, tagged Action Flows, Business Objects, Custom Code, Layout, UI, Web 
    10 Views
    Title:
    State Management with a Data Grid ** Need Advice***
    Summary:
    Managing the State of the page when a user changes rows
    Content:

    Hello,

    I have a data grid in the image file below.  It has six fields as follows:

    Line Num /  GL Date / GL Account / Transaction Type / Amount / Description

     

    As users move from field to field and one row to the next, I have a series of functions that are called to keep the ADP updated and refreshed.

    The reason I need to do this is the GL Account field is based on a modal (see the image).  The fields entered in the modal update the GL Account field (via a function when the user clicks OK) with the concatenated values of the entered fields.  As the user moves through the fields, there is another function based on a value change of the amount field.  This calls the same function adding the Transaction Type and Amount Fields to the ADP.  The user must leave the Amount field by navigating to the last field Description.  Then when the user goes to the next row a table event calls the same function and updates values in case the user does not navigate to the description field.  

    It is a lot to do to keep the ADP current.  I only have to do this because of the function to concatenate the GL Account field.  If I did not have that I would just update the array as the user moved between rows.

    The problem arises if the user does not navigate to the description field.  What happens is the variable for amount does not get updated for the new amount since the user did not leave the field while on the row.  Since the amount field is value event based, the variable is never known.   

    If I can force the user into the description field,  the problem resolves but I do not know how to do that.

    Is there a better way to keep the state managed in a data grid that requires updating field by field due to my situation?

    Thanks,

    Steve

     

    *********************UPDATE********************************

    I was able solve the issue using an OnRawValueChange event.

    if the user clicks in the amount field and begins entering a number, the raw value is picked up without having to update the ADP.

    I collect the raw value in variable and used a test to assign the amount variable.  If the raw value was zero, use the amount in the array, otherwise, use the raw value.

    The result is if the user goes to the next row without leaving the amount field on the previous row, the raw value is used to update the ADP.  Otherwise, the amount in the array is used.

    Thanks,

    Steve

    *********************ANOTHER UPDATE********************************

    Okay, I though this was solved but it is not.  The problem is that I am trying to collect a number value as it is entered using an ON-RAW-VALUE-CHANGED event.  The field is a type of Number while the on-raw value-changed event is a type of string.  It results in inconsistent behavior when the function is called to update the row.  Sometimes it succeeds while other times it fails with type error.

    Is there a way to get around this?  I know I can use parseFloat() but that the issue is with the raw value event vs an input number field.  Any help is appreciated.

    Thanks,

    Steve

     

     

     

    Version:
    19.1.3
    Image: