1

I'm converting a DOJO page that builds a Dijit Tree with live data from a 3rd party to use JS Remoting as the data source instead of directly calling the API (for security reasons). I've been able to convert most of the AJAX calls to JS Remoting, but the one that is giving me trouble is trying to convert a JsonRest store to leverage JS Remoting. Has anyone had any experience with this? It seems like the DOJO xhr request must return an actual object from its invocation (specifically, it's usage in the get method) whereas JS Remoting seems to return null and rely on work being done in the callback handlers, which would fire too late when trying to override the native get method.

To ease development, my APEX remoteaction's are stubbed out to just return objects representing deserialized JSON, so this is purely an exercise in javascript at the moment.

1 Answer 1

2

There isn't a 1:1 comparison between data methods which call an endpoint and JS Remoting. Since part of the idea behind JS Remoting is to remove API calls.

I'm not familiar with Dijit, and haven't used Dojo in a while, but I did run into a similar thing recently using the jqGrid plugin for jQuery. Basically you have to hook directly where the plugin is setting the data when it returns from the API call. Then you can call that from the JS Remoting callback.

1
  • Good advice. What I ended up doing is identifying the calls to this get() method, and rewriting those to instead use remoting. These methods (getChildren, getRoot) were already asynchronous, so overriding them was much easier that trying to make an asynchronous call synchronous. Commented Mar 11, 2013 at 17:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .