The API is up to you guys to decide what’s best for us to use it. So I’ll leave it to you for that.
I still like the idea to not just specify x, y but to define it to show on grid and on chart.
Maybe could also explore the idea of allowing to define the width or dimension of the quickinfo box.
I’ll love to try out the features once you have a pre-release to see how things are once you are ready.
By default, when it is started, only the grid will be shown.
Click on any task in the grid, will display the quickinfo alignment correctly.
Now, click Show to show the chart.
Click on the any task and you will see that the quickinfo alignment is off.
This only happens if using this to display the quickinfo (in GanttHook.js - useQuickInfo())
if (gantt.config.show_chart) {
const quickInfo = document.getElementsByClassName("gantt_cal_quick_info")[0];
if (quickInfo) {
gantt.$grid.appendChild(quickInfo);
quickInfo.style.left = '0px';
}
}
If you were to remove useQuickInfo() in GanttChart.js, and revert back to the original behavior of quickinfo, then there wouldn’t be any alignment issue.
In case timeline is not shown Quickinfo popup is created as a child of the <div class="gantt_grid_data"> element.
But when the timeline is shown Quickinfo is created as a child of the <div class="gantt_grid">.
So you need to change this line in GanttHook.js:
Is there any way to show the quick_info when it is a unscheduled_task?
An example in this snippet.
I would like to display it on the grid like the first 3 task, but if it’s unscheduled task, nothing will be shown on the chart, which then I believe, cannot grab this.
var quick_info = document.getElementsByClassName("gantt_cal_quick_info")[0]
Any other way to do so? So that I can display the quick_info on the Grid?
Hi Joseph,
It appears to be a bug on our end, thank you for noticing it. I’ve forwarded this issue to our dev team. It will be fixed in the next bugfix release, either tomorrow or early next week.
Try to click on the > to expand or collapse the tree. Notice that the QuickInfo will be shown when it is clicked. However, with that, it is ‘blocking’ the view (in a way) of the child task.
Also, I don’t think you need onTaskSelected handler anymore. If I understand correctly, it was needed as a workaround for the previous versions of the gantt, to display the Quick Info popup when the timeline (chart) is hidden. Now it should work out of the box and you shouldn’t need to attach the tooltip element manually
Hi Joseph,
Sorry, I’ve misspoken. I meant the quick info element, not the tooltip element.
I was referring to this code from your previous snippet:
gantt.attachEvent("onTaskSelected", function(id){
setTimeout(function(){
var no_chart = false;
if (!gantt.config.show_chart) {
gantt.config.show_chart = true;
no_chart = true;
}
var quick_info = document.getElementsByClassName("gantt_cal_quick_info")[0]
gantt.$grid.appendChild(quick_info)
quick_info.style.left = '0px';
if (no_chart) gantt.config.show_chart = false;
})
});
As far as I understand, it was a workaround needed to make quick info work when the chart is hidden. If it’s so - I believe it’s no longer needed. If you use the latest gantt, you can simply remove this code and everything should continue working.
About hideQuickInfo inside the setTimeout - it works so, because when you click the expand/collapse button of the task it also invokes the showQuickInfo from a timeout: https://github.com/DHTMLX/gantt/blob/6.2.6/codebase/sources/ext/dhtmlxgantt_quick_info.js#L123
As a result, the quick info is not yet displayed when onTaskOpened/onTaskClosed is fired and you can’t cancel the quick info timeout. So as a workaround, we set another timeout which will fire after the quick info and hide the popup from there.
Yes, removing it works when Chart is hidden. But I also need it to display on the Grid when the Chart is in expanded mode. Hence, removing it will not allow me to always display the QuickInfo on the Grid. Unless you have some API that allows me to set gantt.config.quickinfo = grid or similar where I can define where the QuickInfo is always shown at, otherwise, I think I still require that portion of the code.
I can’t recall what event I am tapping on at the moment, but the current code looks like this
if (gantt.config.show_chart) {
var quick_info = document.getElementsByClassName("gantt_cal_quick_info")[0]
gantt.$grid.appendChild(quick_info)
quick_info.style.left = '0px';
}
So that whenever it is clicked, even on the bar in the Chart, QuickInfo will always be displayed on the Grid.
I have a question, my gantt chart is in a container, so when i import the tooltip it displays outside the container, and by that it is miles away from the content that is being hovered over. Is there a way to make this work inside the container?
Here’s an image showing the bug: https://imgur.com/a/sdtlyYC
Hi @Feel_the_Beats,
I reproduced the issue but still not sure that it is your situation.
Steps that I did to reproduce:
I create a simple template with a tooltip extension. (like in the attached snippet)
Put the gantt container inside another container(div.outer).
Add margin-top and padding-top attributes to the gantt container.
Hover the mouse over the task.
The tooltip position is wrong.
Snippet with reproduced issue(check HTML tab): https://snippet.dhtmlx.com/5a2509f7c
Is it the same issue that you have?
It appears to be a bug on our end, thank you for noticing it. I’ve forwarded this issue to our dev team and will inform you when this issue will be fixed.
To avoid this problem, I could advise you to use a padding-top attribute instead of a margin. Like in the following snippet: http://snippet.dhtmlx.com/082d8554a
If you’re having a different issue, could you reproduce it in the following snippet: https://snippet.dhtmlx.com/5a2509f7c , click the share button and send me the link?
Thank you for the effort for bringing this new feature.
I tested out briefly, but there is still no way to control whether to display the quickInfo in the chart or grid, am I right?
I updated previous snippet, could you show me how I can use setContainer (can I?) to set to display on the grid instead of the chart?
Also, if I use gantt.ext.quickInfo.setContent method, within the onTaskSelected, there seem to place 2 quickinfo dialog unless I use setTimeout but the same does not happen when it use gantt.ext.quickInfo.show() inside onTaskSelected