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

Parents
  • 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

  • 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!

Reply
  • 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!

Children
  • 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, thanks for the replay so my comment go hung up in moderation for a day or so and subsequently solved my issue.

    Just for reference in case it might help you, what we're doing for a 'bulk edit' case which respects permissions is the following:

    Action on the Itemtype

    Use VC_GetSelectedItems to get the ids

    From the 'complete' method we get the ids and then call a dialog/form for inputting the values we need.  The 'ok' button on that dialog collects the necessary info and feeds back to the 'complete' method as a dialog result.

    Then the result is fed into a server method to perform the various actions.  We've implemented a way to basically log each row's result into a string.  This way it'll report if it has to skip an item cause you don't have permissions.

    The result string then gets displayed in the form "PE_ChangeItemValidationDialog".  We've added a callback in the string (e.g.:  res = aras.modalDialogHelper.show('DefaultPopup', wnd, param, options, 'ShowFormAsADialog.html', callback);

    var callback = {
    oncancel: function refreshsearchgrid() {
    top.aras.getMainWindow().work.searchContainer.runSearch(); //if successful, then refresh the search grid
    }
    };

    That callback refreshes the search grid.

    Anyways, just thought I'd share in case it helps anyone else.