Forum Discussion

antoined's avatar
antoined
Ideator I
5 years ago
Solved

How to call a client method from another client method?

Hello everybody.

I have several client methods which are sharing some common code. I would like to put that code in a method, and call that method from the other methods, everything is client side. How can I do that?

  • So, I finally found this:

    /**
     * Method to evaluate JavaScript stored as a Method item on the client side.
     * @param {string} methodName the name of the Method item
     * @param {Object} itemDom the item dom
     * @param {Object} [addArgs] Object with any additional parameters.
     */
    Aras.prototype.evalItemMethod = function Aras_evalItemMethod(methodName, itemDom, addArgs)

    And indeed I am able to call a method when giving it the good methodName. Then, from the other methods, I can access the addArgs array with arguments[1].

4 Replies

  • So, I finally found this:

    /**
     * Method to evaluate JavaScript stored as a Method item on the client side.
     * @param {string} methodName the name of the Method item
     * @param {Object} itemDom the item dom
     * @param {Object} [addArgs] Object with any additional parameters.
     */
    Aras.prototype.evalItemMethod = function Aras_evalItemMethod(methodName, itemDom, addArgs)

    And indeed I am able to call a method when giving it the good methodName. Then, from the other methods, I can access the addArgs array with arguments[1].

  • You can wrap the server part of a shared method with this.isSimulation

    When you run a shared method it first runs a simulation on the client and then on server - updating the client with its results (which are usually the same - which is why it's called Optimistic UI).

    • antoined's avatar
      antoined
      Ideator I

      I'm not sure what you are talking about. I don't have a server part of the method.

      • AngelaIp's avatar
        AngelaIp
        Ideator I

        Hi Antoined,

        I assume you have been fooled by a spam bot.

        Check out my super handy blog article where I give an overview of the various Method calls:

        https://plm-underground.com/method-calls

        JS sample is at the bottom. I also plan a video regarding Method calls on my Youtube channel this week. [emoticon:c4563cd7d5574777a71c318021cbbcc8]