Override start date and end date after parsing data

Hi,

Is it possible to override start and end date after loading data ?

I have 2 inputs, one with a date picker and another one for the duration. When I modify the value of my datepicker input, I would like to display this start date on the gantt even if this period is empty. With the value of the period input, I would like to display this end date in the gantt.

for example, i’v a gantt with the first task started on november 11th 2013 with a duration of 10 days. the datepicker input with a value of september 1st 2013 and period input with a value of 90.
I would like to display a gantt with a start date of september 1st 2013 and end date of 29 november 2013.

Is it possible ?

Thanks

You may try setting .start_date and .end_date configs of the gantt.
for example:[code]var scaleStart = new Date(2013, 8, 1),
scaleDuration = 90;

gantt.config.start_date = scaleStart;
gantt.config.end_date = gantt.date.add(scaleStart, scaleDuration, ‘day’);[/code]
docs.dhtmlx.com/gantt/api__gantt … onfig.html
docs.dhtmlx.com/gantt/api__gantt … onfig.html
docs.dhtmlx.com/gantt/api__gantt_date_other.html

Hi,
Why this date returns a wrong month :
var scaleStart = new Date(2013,03,01);

it returns april instead of march

and dates with a month value of 1 or 2 freeze the gantt, have you an idea ?

thanks

I found in a forum : “In the javascript world months begin with zero”, if it’s can help

That’s correct, JS months are zero-based
0 - January,
1 - February,
2 - March,
etc

Hi,
I understand these parameters, but I don’t know why the gantt freeze when I put 2 for month :

var scaleStart = new Date(2013,02,10);

Could you reproduce it ?

Someone can reproduce this issue ?

When I put these parameters :

var scaleStart = new Date(2013,00,10); //january
//or 
var scaleStart = new Date(2013,01,10); //february
//or
var scaleStart = new Date(2013,02,10); //march

scaleDuration = 90;
gantt.config.start_date = scaleStart;
gantt.config.end_date = gantt.date.add(scaleStart, scaleDuration, 'day');

The browser freeze, and the memory increase up to 1Gb

For other months there is no bug.

Thanks

Hello,
sorry for the delayed reply.
The date itself does not seem to cause an issue, at least on our local version. Do you have any data(tasks) in the gantt? Could you attach it so we could run a complete demo?

Hi,
I’v a gantt with multiple scales, and my browser freeze only when I have a day scale, maybe there is a wrong config ? Can you look at that ?

// gantt config
gantt.config.xml_date="%d/%m/%Y %H:%i";
gantt.config.scale_unit = "day";
gantt.config.step = 1;

if (sLang == "fr")
	gantt.config.date_scale = "%d %F %Y"
else
	gantt.config.date_scale = "%F %d %Y"
gantt.config.min_column_width = 50;
gantt.config.subscales = [
	{unit:"hour", step:1, date:"%H:%i"}
];
gantt.config.scale_height = 40;

gantt.templates.scale_cell_class = function(date){
	if(date.getDay()==0||date.getDay()==6){
		return "weekend";
	}
};
gantt.templates.task_cell_class = function(item,date){
	if(date.getDay()==0||date.getDay()==6){
		return "weekend"
	}
};

//loading data
gantt.init("id_div_gantt");

rData = {"data":[
	{"id":"0_9775","id_object":"9775", "text":"test", "delay":false , "priority":"3", "open": true, "icon":"227", "toBeSchedule":true, "bTask":false},
	{"id":"9775_9772", "text":"child1", "start_date":"27/04/2014","parent":"0_9775", "icon":"202", "duration":"2"},
	{"id":"9775_11346", "text":"child2", "start_date":"28/04/2014","parent":"0_9775", "icon":"202","duration":"2"}
]}; 
gantt.parse(rData);

//force a start and end date
var scaleStart = new Date(2014,00,1); //jan the first
scaleDuration = 90;
gantt.config.start_date = scaleStart;
gantt.config.end_date = gantt.date.add(scaleStart, scaleDuration, 'day');

Thanks.

I finally understand why my browser freeze !
it’s depend on how many days are displayed in the gantt, is there a way to increase the performance of the gantt ?

In my exemple :

//structure of my tasks to display
{"id":"9775_9772", "text":"child1", "start_date":"27/04/2014","parent":"0_9775", "icon":"202", "duration":"2"},
{"id":"9775_11346", "text":"child2", "start_date":"28/04/2014","parent":"0_9775", "icon":"202","duration":"2"}

//config of start and end date : 
var scaleStart = new Date(2014,3,22); //april the 22th of 2014
scaleDuration = 30; //ok for 30, if I put 40, it freeze my browser
gantt.config.start_date = scaleStart;
gantt.config.end_date = gantt.date.add(scaleStart, scaleDuration, 'day');