mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-16 21:13:23 +01:00
Add refresh(id, type) function to et2_gantt widget
This commit is contained in:
parent
ee46807842
commit
9e0b882f92
@ -100,9 +100,6 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
// Gantt instance
|
// Gantt instance
|
||||||
this.gantt = null;
|
this.gantt = null;
|
||||||
|
|
||||||
// Flag to avoid re-rendering several times while loading
|
|
||||||
this.gantt_loading = false;
|
|
||||||
|
|
||||||
// DOM Nodes
|
// DOM Nodes
|
||||||
this.filters = $j(document.createElement("div"))
|
this.filters = $j(document.createElement("div"))
|
||||||
.addClass('et2_gantt_header');
|
.addClass('et2_gantt_header');
|
||||||
@ -127,6 +124,8 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
destroy: function() {
|
destroy: function() {
|
||||||
if(this.gantt !== null)
|
if(this.gantt !== null)
|
||||||
{
|
{
|
||||||
|
// Unselect task before removing it, or we get errors later if it is accessed
|
||||||
|
this.gantt.unselectTask();
|
||||||
this.gantt.detachAllEvents();
|
this.gantt.detachAllEvents();
|
||||||
this.gantt.clearAll();
|
this.gantt.clearAll();
|
||||||
this.gantt = null;
|
this.gantt = null;
|
||||||
@ -267,9 +266,6 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
set_value: function(value) {
|
set_value: function(value) {
|
||||||
if(this.gantt == null) return false;
|
if(this.gantt == null) return false;
|
||||||
|
|
||||||
|
|
||||||
if(console.time) console.time("Gantt set_value");
|
|
||||||
|
|
||||||
// Unselect task before removing it, or we get errors later if it is accessed
|
// Unselect task before removing it, or we get errors later if it is accessed
|
||||||
this.gantt.unselectTask();
|
this.gantt.unselectTask();
|
||||||
|
|
||||||
@ -299,21 +295,8 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
data: value.data || [],
|
data: value.data || [],
|
||||||
links: value.links || []
|
links: value.links || []
|
||||||
};
|
};
|
||||||
|
this.config.start_date = value.start_date || null;
|
||||||
this.config.start_date = value.start_date ? new Date(value.start_date) : null;
|
this.config.end_date = value.end_date || null;
|
||||||
this.config.end_date = value.end_date ? new Date(value.end_date) : null;
|
|
||||||
|
|
||||||
// Set flag so events don't trigger an extra render
|
|
||||||
gantt_widget.gantt_loading = true;
|
|
||||||
if(gantt_widget.getWidgetById('start_date'))
|
|
||||||
{
|
|
||||||
gantt_widget.getWidgetById('start_date').set_value(value.start_date || null);
|
|
||||||
}
|
|
||||||
if(gantt_widget.getWidgetById('end_date'))
|
|
||||||
{
|
|
||||||
gantt_widget.getWidgetById('end_date').set_value(value.end_date || null);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.parse(safe_value);
|
this.parse(safe_value);
|
||||||
|
|
||||||
gantt_widget.gantt_loading = false;
|
gantt_widget.gantt_loading = false;
|
||||||
@ -719,19 +702,7 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
// Bind AJAX for dynamic expansion
|
// Bind AJAX for dynamic expansion
|
||||||
// TODO: This could be improved
|
// TODO: This could be improved
|
||||||
this.gantt.attachEvent("onTaskOpened", function(id, item) {
|
this.gantt.attachEvent("onTaskOpened", function(id, item) {
|
||||||
var task = this.getTask(id);
|
gantt_widget.refresh(id);
|
||||||
// Node children are already there & displayed
|
|
||||||
var value = gantt_widget.getInstanceManager().getValues(gantt_widget.getInstanceManager().widgetContainer);
|
|
||||||
|
|
||||||
this.showCover();
|
|
||||||
var request = gantt_widget.egw().json(gantt_widget.options.autoload,
|
|
||||||
[id,value,task.parent||false],
|
|
||||||
function(data) {
|
|
||||||
this.parse(data);
|
|
||||||
this.hideCover();
|
|
||||||
},
|
|
||||||
this,true,this
|
|
||||||
).sendRequest();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
@ -797,9 +768,6 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
var widget_change = _widget.change;
|
var widget_change = _widget.change;
|
||||||
|
|
||||||
var change = function(_node) {
|
var change = function(_node) {
|
||||||
// Stop if we're in the middle of loading
|
|
||||||
if(gantt_widget.gantt_loading) return false;
|
|
||||||
|
|
||||||
// Call previously set change function
|
// Call previously set change function
|
||||||
var result = widget_change.call(_widget,_node);
|
var result = widget_change.call(_widget,_node);
|
||||||
|
|
||||||
@ -816,13 +784,6 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
|
|||||||
gantt_widget.gantt.config.start_date = start && start.getValue() ? new Date(start.getValue()) : gantt_widget.gantt.getState().min_date;
|
gantt_widget.gantt.config.start_date = start && start.getValue() ? new Date(start.getValue()) : gantt_widget.gantt.getState().min_date;
|
||||||
// End date is inclusive
|
// End date is inclusive
|
||||||
gantt_widget.gantt.config.end_date = end && end.getValue() ? new Date(new Date(end.getValue()).valueOf()+86400000) : gantt_widget.gantt.getState().max_date;
|
gantt_widget.gantt.config.end_date = end && end.getValue() ? new Date(new Date(end.getValue()).valueOf()+86400000) : gantt_widget.gantt.getState().max_date;
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO: some weirdness here when we start changing min_date
|
|
||||||
gantt_widget.gantt.config.start_date = start && start.getValue() ? new Date(start.getValue()) : gantt_widget.stored_state.min_date || gantt_widget.gantt.getState().min_date;
|
|
||||||
// End date is inclusive
|
|
||||||
gantt_widget.gantt.config.end_date = end && end.getValue() ? new Date(new Date(end.getValue()).valueOf()+86400000) : gantt_widget.stored_state.max_date || gantt_widget.gantt.getState().max_date;
|
|
||||||
*/
|
|
||||||
if(gantt_widget.gantt.config.end_date <= gantt_widget.gantt.config.start_date)
|
if(gantt_widget.gantt.config.end_date <= gantt_widget.gantt.config.start_date)
|
||||||
{
|
{
|
||||||
gantt_widget.gantt.config.end_date = null;
|
gantt_widget.gantt.config.end_date = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user