Gantt Tooltip - Refresh content

Hi

I am using Gantt 6.0.7 enterprise edition. On clicking a task, I would like to fire an API call that fetches the data for the quickInfo box. The Quick Info Content seems closely tied to the task but in my case, I have to fetch that data from a separate API. I am able to place the gantt.templates.quick_info_content inside the onQuickInfo event but the content doesn’t seem to refresh.

Any pointers on how I could follow this sequence, would help

  1. Click on a task
  2. Make an external API call to fetch the data
  3. Open the quick info box and display the data.

Thanks
Pramod

Hi @Pramod_Nair,

If you want to avoid changing sources of extension(which is not recommended), the closest solution is to change hide the default quick info from the on onTaskClick event:

gantt.attachEvent("onTaskClick", function (id, e) {
  // hide the default quick info 
  setTimeout(function () {
    gantt.ext.quickInfo.hide();
  }, 0);

After that, you can make your AJAX call and get the required value, and pass it into the quick_info_content when the call is complete.

Here is an example of code(with timeouts instead of real calls):

var val = false;
gantt.attachEvent("onTaskClick", function (id, e) {
  // hide the default quick info 
  setTimeout(function () {
    gantt.ext.quickInfo.hide();
  }, 0);
  // some ajax call
  setTimeout(() => {
    val = "Some value from the back";
  },50)
  if (!gantt.utils.dom.closest(e.target, ".gantt_add")) {

    setTimeout(function () {
      gantt.templates.quick_info_content = function(start, end, task){ 
        return val; 
      };
      gantt.ext.quickInfo.show(id);
    }, 60);      // show the quick info after the value from call is received (.then)
  }
  return false; 
}); 

Here is a demo:
http://snippet.dhtmlx.com/5/5a1f99050

Kind regards,