Forum Discussion

Frank_Guarino's avatar
Frank_Guarino
Ideator I
9 months ago
Solved

How to update grid values without running .apply() (I want to update it only in the frontend and not post it)

Hello,

There is a relationship grid row that I would like users to mass edit. I so far configured a method to appear in the CUI along with the functionality of having multiple rows highlighted, and can get the relationship Ids as well.

What I need next is to reference the frontend dom of the grid, get a particular column of that row, and set it to something. Is there a reliable method for that? 

Best Regards,

Frank

  • Hello, I found out the answer to this.

    JavaScript Aras method, aras.setItemProperty() is what can perform the front-end sided operation.

    The parameters descriptions are found when you dive into the method. Ensure that srcNode is an Item.node, and itemTypeNd is the item "Item" of the item, and also should be passed as an item.node. Passing them as item.node is important to have .selectSingleNode() available directly, as that method is called directly on the parameters and will return an error such as 'method selectSingleNode()' doesn't exist.

    I configured this to be run on an action, and performs much faster than running a .apply() on each record. It also shows the updates on the screen in real time, so once the operation is complete it will be apparent as you can see the grid change.

    Best Regards,

    Frank

5 Replies

  • Hello, I found out the answer to this.

    JavaScript Aras method, aras.setItemProperty() is what can perform the front-end sided operation.

    The parameters descriptions are found when you dive into the method. Ensure that srcNode is an Item.node, and itemTypeNd is the item "Item" of the item, and also should be passed as an item.node. Passing them as item.node is important to have .selectSingleNode() available directly, as that method is called directly on the parameters and will return an error such as 'method selectSingleNode()' doesn't exist.

    I configured this to be run on an action, and performs much faster than running a .apply() on each record. It also shows the updates on the screen in real time, so once the operation is complete it will be apparent as you can see the grid change.

    Best Regards,

    Frank

    • jeff_stroh's avatar
      jeff_stroh
      Ideator I

      Hey Frank, thanks for sharing this.  I have a similar use case, but I'm passing the itemIDs from the grid to server method and then returning the results.  Was struggling with getting the revised items to refresh in the search grid.

      It sounds like you doing everything Client side, is that right?

      Just trying to see if you have a touch more code to share.  Thanks in advance!

      • Frank_Guarino's avatar
        Frank_Guarino
        Ideator I

        Hi Jeff,

        I was doing everything client side.

        For your case, if you are running server methods which run .apply() to perform the changes and these changes are not showing right away in the grid, there is likely a method for refreshing the aras grid in the code tree. You could try aras.uiReShowItem(oldItemId, itemId, editMode, viewMode), but I believe that may only work with the form but it might work with relationship grid. I think that was the method I had used.

        I no longer recommend doing any updates fully client side - I will elaborate below:

        I feel bad... I had deleted the method I had written, so I don't have it off the top of my head. Reason why I deleted it was due to how performing any edits precisely only with frontend had naturally circumvented the Aras Permissions records. I believe I was getting my updates to show right away due to JS running .applySQL which would run right away as opposed to waiting for the method's transaction to complete, and with aras.uiReShowItem() per each record. Also another tidbit was that applySQL only works when the user running the method has SQL permissions and was also bad practice on my part. The current way I have it implemented is with server side, but I have yet to finish the work, and will likely come to what you are facing. I will let you know if I find anything

  • Hey Frank, do you have a bit more info to share on this?  I assume you're doing everything from the Client method and nothing being passed server side?

    Right now I'm using an action with VC_GetSelectedItems to feed the method which is doing the work.  Presumably you're skipping that first method and simply running it all in one go?

    Thanks for the guidance.