SugarCRM 7.x How to refresh a dashlet programmatically

Hello everyone, I'm used to search answers on this forum for a while, but for once, I have to ask my own question :)

On sugarcrm 7.6, I made a completely new dashlet, It was difficult but I did it.
Now I need to add a button in the dashlet to refresh it's content.

I guess I can use the loadData method embeded in the myDashlet.js file but how to ?

I tried to something in javascript with
App.***
But I'm not successful :(

Additionnaly, I would like to automatically set filter when I clicked on this button and before refreshing. Any idea ?
Parents
  • Hi, thanks for your answer.
    What does "this" refer to ? The current object...
    Of course, I'm not in the dashlet.js defining dashlet's behavior, I'm in another js controlling what my button should do.
    So my problem is how to get the correct "this" and then I can call every suitable method on it.
  • Actually, I don't think you can describe the behavior of a custom button in the middle of you dashlet within the js-controller right ?
    So I added a <script></script> in the .hbs file to manage this behavior. Is it the correct way or did I miss something ? I would strongly appreciate to do it in the js-controller file of course, but how ?
    Thanks for your help
  • Hi Shijin
    I'm new in Sugar and I have 2 differents dashlets, "dashlet1" have a "query1" to a none sugar database, shows the result with a link for each row that contains an id that I want to obtain because I used to complete "query2" to another table and had to show this results in "dashlet2". These dashlets are in Home and have the same api for the queries but they have their own methods, something like this:

    /custom/clients/base/views/dashlet1/dashlet1.hbs
    /custom/clients/base/views/dashlet1/dashlet1.js
    /custom/clients/base/views/dashlet1/dashlet1.php
    /custom/clients/base/views/dashlet2/dashlet2.hbs
    /custom/clients/base/views/dashlet2/dashlet2.js
    /custom/clients/base/views/dashlet2/dashlet2.php
    /custom/modules/Leads/clients/base/api/getInfoApi.php

    I need to know how to catch the event onclic from one link in dashlet1 and load data in dashlet2 depending of the id.








Reply
  • Hi Shijin
    I'm new in Sugar and I have 2 differents dashlets, "dashlet1" have a "query1" to a none sugar database, shows the result with a link for each row that contains an id that I want to obtain because I used to complete "query2" to another table and had to show this results in "dashlet2". These dashlets are in Home and have the same api for the queries but they have their own methods, something like this:

    /custom/clients/base/views/dashlet1/dashlet1.hbs
    /custom/clients/base/views/dashlet1/dashlet1.js
    /custom/clients/base/views/dashlet1/dashlet1.php
    /custom/clients/base/views/dashlet2/dashlet2.hbs
    /custom/clients/base/views/dashlet2/dashlet2.js
    /custom/clients/base/views/dashlet2/dashlet2.php
    /custom/modules/Leads/clients/base/api/getInfoApi.php

    I need to know how to catch the event onclic from one link in dashlet1 and load data in dashlet2 depending of the id.








Children