I am new to using DHMTLX Gantt but I am very pleased with it.
For the requirements I have I need to implement a custom dialog so I have attached to the “onBeforeLightbox” event and provided the code for displaying my custom dialog and always returning false. I am using the dataProcessor for my server calls.
// specifying the date format
gantt.config.xml_date = "%Y-%m-%d %H:%i";
gantt.init("ganttTest");
// enabling data loading.
gantt.load("../api/gantt/data");
// initializing dataProcessor
var dp = new gantt.dataProcessor("../api/gantt/");
// and attaching it to gantt
dp.init(gantt);
// setting the REST mode for dataProcessor
dp.setTransactionMode("REST");
When I click the cancel button on my dialog for adding a new task I call the gantt.deleteTask(id) method as a number of demos show in order to remove the “new task” from the gantt chart, but I have noticed this calls the DELETE method on the server. If I use the default provided Lightbox dialog in this scenario and click its cancel button I notice that the dataProcessor does not end up calling the DELETE method on the server. After debugging through some code I found that this was accomplished by using a “private” method of gantt._deleteTask(id, silent). So for testing purposes I updated my code for the cancel button click of my custom dialog to be:
if (task.$new) {
gantt._deleteTask(id, true);
}
taskEditWindow.hide();
gantt.refreshData();
This behaves as I would desire by not calling the server when removing a task that has not really been added on the server yet.
So my real question … Is there another more “proper” way of accomplishing this rather than calling the “Private” method?
Thanks!