From ed861b33f32b385689d03007e72652c26f8e75c2 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 18 Aug 2014 23:09:18 +0000 Subject: [PATCH] - Change zoom auto level to better suit projects a day or two long - Reset start/end dates when changing data --- etemplate/js/et2_widget_gantt.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_widget_gantt.js b/etemplate/js/et2_widget_gantt.js index 764ea0a8a7..5df067c2ba 100644 --- a/etemplate/js/et2_widget_gantt.js +++ b/etemplate/js/et2_widget_gantt.js @@ -229,11 +229,15 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput], set_value: function(value) { if(this.gantt == null) return false; + this.gantt.clearAll(); + // Ensure proper format, no extras var safe_value = { data: value.data || [], links: value.links || [] }; + this.gantt.config.start_date = null; + this.gantt.config.end_date = null; this.gantt.parse(safe_value); // Set some things from the value @@ -341,8 +345,8 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput], { level = 3; } - // More than 3 days - else if (difference > 259200) + // More than 1 day + else if (difference > 86400) { level = 2; } @@ -505,11 +509,12 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput], // Bind AJAX for dynamic expansion // TODO: This could be improved this.gantt.attachEvent("onTaskOpened", function(id, item) { + var task = this.getTask(id); // Node children are already there & displayed var value = gantt_widget.getInstanceManager().getValues(gantt_widget.getInstanceManager().widgetContainer); var request = gantt_widget.egw().json(gantt_widget.options.autoload, - [id,value], + [id,value,task.parent||false], function(data) { this.parse(data); }, @@ -732,7 +737,7 @@ et2_register_widget(et2_gantt, ["gantt"]); $j(function() { // Set icon to match application gantt.templates.grid_file = function(item) { - if(!item.pe_app || !egw.image(item.pe_icon)) return "
"; + if(!item.pe_icon || !egw.image(item.pe_icon)) return "
"; return "
"; }