AnsweredAssumed Answered

Access model variable from dashlet JavaScript

Question asked by sokolko on Jul 25, 2012
Latest reply on Jul 27, 2012 by sokolko
Hello all! I'm developing a custom dashlet for Alfresco share. I've seen many examples and made several simple projects, but now I need something more complicated. I have a project (it's a set of files). Some of them contain JS code.
My idea is to make a query to a webscript in <Project home>/config/alfresco/site-webscripts/org/alfresco/components/dashlets/mydashlet.get.js, store its result in model variable and then access it in <Project home>/source/web/components/dashlets/mydashlet.js
I try to do it like this:
1) <Project home>/config/alfresco/site-webscripts/org/alfresco/components/dashlets/mydashlet.get.js

function main()
      var json ="/api/task-instances?state=completed");
         if (json.status == 200)
            data = eval('(' + json + ')');
2)<Project home>/source/web/components/dashlets/mydashlet.js

loadData: function MyDashlet_loadData()

Nothing happens and I don't see my message… Any help or ideas really appreciated: I've been trying to do it for a week…
P.S. In my <Project home>/config/alfresco/site-webscripts/org/alfresco/components/dashlets/mydashlet.get.html.ftl I have access to ${data} from my