bug in gantt.confirm

gantt.confirm does not set id; it’s always blank. According to docs at docs.dhtmlx.com/message__window … messagebox, an ‘id’ passed in JSON should set the id of the message box. Request bugfix.

Example:
visit, eg docs.dhtmlx.com/gantt/samples/0 … tyles.html, and open Javascript console.

gantt.confirm({
id: “SaveGanttBox”,
title: “Want to save?”,
type:“confirm-warning”,
text: “Your changes will be lost if you don’t save them.”,
cancel: “Discard”,
ok: “Save”,
callback: function(buttonPress) {buttonPress ? saveGantt() : modifiedTasks = {};}
})

does not set an id. One workaround is to just do

gantt.confirm({
title: “Want to save?”,
type:“confirm-warning”,
text: “Your changes will be lost if you don’t save them.”,
cancel: “Discard”,
ok: “Save”,
callback: function(buttonPress) {buttonPress ? saveGantt() : modifiedTasks = {};}
}).id = “SaveGanttBox”;

and another is to:

gantt.confirm({
title: “Want to save?”,
type:“confirm-warning”,
text: “Your changes will be lost if you don’t save them.”,
cancel: “Discard”,
ok: “Save”,
callback: function(buttonPress) {buttonPress ? saveGantt() : modifiedTasks = {};}
}).setAttribute(“id”, “SaveGanttBox”)

But both of these lose the return value.

Frank

Hello Frank,
Could you clarify why do you want to get the id of the confirm box?
In our article it is used to hide basic popup message, although it is said that the method cannot be used with modal boxes (including alert and confirm):
docs.dhtmlx.com/gantt/desktop__ … pupmessage

Gantt doesn’t return any parameters that you specify in the confirm config. For example,in the following code you can try to return all parameters but they are undefined:
snippet.dhtmlx.com/8082c4d13

But you can use the variable to hide the confirm box or do something else with it:
snippet.dhtmlx.com/d4b8d15b8