Search code examples
javascriptdhtmlx

how can i display the start date, the end date and the duration from the lightbox in dhtmlx gantt?


in my web application J2EE i'm using dhtmlx to display gantt chart, i displayed the value of description from the lightbox

alert(gantt.getLightboxSection("description").getValue())

i don't know how to display the other fields, i used

alert(gantt.getLightboxSection("time").getValue());

but i had [object object]. how can i display the start_date, end_date and the duration from the lightbox ? here the picture of the lightbox


Solution

  • The time control is mapped to several properties, so it returns an object with following structure

    {
      start_date: Date,
      end_date: Date,
      duration: Number
    }
    

    If you want to view it in the alert you need to stringify the object to JSON:

    alert(JSON.stringify(gantt.getLightboxSection("time").getValue()));
    

    Sample http://docs.dhtmlx.com/gantt/snippet/ed9eab5c

    If you need a formatted output, you can access the object values - http://docs.dhtmlx.com/gantt/snippet/ff33992d