diff --git a/phpgwapi/js/egw_action/egw_action_dragdrop.js b/phpgwapi/js/egw_action/egw_action_dragdrop.js index a811fb0de5..0c0e701fa1 100644 --- a/phpgwapi/js/egw_action/egw_action_dragdrop.js +++ b/phpgwapi/js/egw_action/egw_action_dragdrop.js @@ -83,6 +83,11 @@ function egwDragActionImplementation() if (node) { + // Prevent selection + node.onselectstart = function () { + return false; + }; + $(node).draggable( { "distance": 20, @@ -101,16 +106,27 @@ function egwDragActionImplementation() $(node).data("ddTypes", ai.ddTypes); $(node).data("selected", ai.selected); + if (ai.helper) + { + // Append the helper object to the body element - this + // fixes a bug in IE: If the element isn't inserted into + // the DOM-tree jquery appends it to the parent node. + // In case this is a table it doesn't work correctly + $("body").append(ai.helper); + return ai.helper; + } + // Return an empty div if the helper dom node is not set - return ai.helper ? ai.helper: $(document.createElement("div")); + return $(document.createElement("div")); }, "start": function(e) { return ai.helper != null; }, - // Solves problem with scroll position changing in the grid + // Solves problem with scroll position changing in the grid // component "refreshPositions": true, - "scroll": false + "scroll": false, + "containment": "document" } ); @@ -326,8 +342,10 @@ function egwDropActionImplementation() // set of properties. var popup = getPopupImplementation(); var pos = popup._getPageXY(event); - popup.doExecuteImplementation(pos, selected, links, - _context); + window.setTimeout(function() { + popup.doExecuteImplementation(pos, selected, links, + _context); + }, 0); // Timeout is needed to have it working in IE } _aoi.triggerEvent(EGW_AI_DRAG_OUT); diff --git a/phpgwapi/js/egw_action/egw_action_popup.js b/phpgwapi/js/egw_action/egw_action_popup.js index 8642fcde85..a6fcff4dd7 100644 --- a/phpgwapi/js/egw_action/egw_action_popup.js +++ b/phpgwapi/js/egw_action/egw_action_popup.js @@ -248,9 +248,9 @@ function egwPopupActionImplementation() // Append the groups to the groups2 array var groups2 = []; - for (k in groups) + for (var i = 0; i < groups.length; i++) { - groups2.push(groups[k].links); + groups2.push(groups[i].links); } _parentGroup.groups = groups2; diff --git a/phpgwapi/js/egw_action/egw_grid_data.js b/phpgwapi/js/egw_action/egw_grid_data.js index 5d8d5fef2b..500fc25c0f 100644 --- a/phpgwapi/js/egw_action/egw_grid_data.js +++ b/phpgwapi/js/egw_action/egw_grid_data.js @@ -68,10 +68,13 @@ function egwGridDataElement(_id, _parent, _columns, _readQueue, _objectManager) this.updatedGrid = null; this.actionLinkGroups = {}; this.group = false; + this.capColTime = 0; this.gridViewObj = null; } +var EGW_GRID_DATA_UPDATE_TIME = 0; + egwGridDataElement.prototype.free = function() { //TODO @@ -79,17 +82,29 @@ egwGridDataElement.prototype.free = function() egwGridDataElement.prototype.set_caption = function(_value) { - this.caption = _value; + if (_value != this.caption) + { + this.capColTime = EGW_GRID_DATA_UPDATE_TIME; + this.caption = _value; + } } egwGridDataElement.prototype.set_iconUrl = function(_value) { - this.iconUrl = _value; + if (_value != this.iconUrl) + { + this.capColTime = EGW_GRID_DATA_UPDATE_TIME; + this.iconUrl = _value; + } } egwGridDataElement.prototype.set_iconSize = function(_value) { - this.iconSize = _value; + if (_value != this.iconSize) + { + this.capColTime = EGW_GRID_DATA_UPDATE_TIME; + this.iconSize = _value; + } } egwGridDataElement.prototype.set_opened = function(_value) @@ -99,7 +114,14 @@ egwGridDataElement.prototype.set_opened = function(_value) egwGridDataElement.prototype.set_canHaveChildren = function(_value) { - this.canHaveChildren = _value && (this.children.length == 0); + // Calculate the canHaveChildren value which would really be set + var rv = _value && (this.children.length == 0); + + if (rv != this.canHaveChildren) + { + this.canHaveChildren = _value; + this.capColTime = EGW_GRID_DATA_UPDATE_TIME; + } } egwGridDataElement.prototype.set_group = function(_value) @@ -150,10 +172,27 @@ egwGridDataElement.prototype.set_data = function(_value) data = val; } + // Set the data column timestamp - this is used inside the grid_view + // row unit in order to only update data which has really changed + var ts = 0; + var newData = true; + + if (typeof this.data[col_id] != "undefined" && this.data[col_id].data == data) + { + ts = this.data[col_id].ts; + newData = false; + } + + if (newData) + { + ts = EGW_GRID_DATA_UPDATE_TIME; + } + this.data[col_id] = { "data": data, "sortData": sortData, - "queued": false + "queued": false, + "time": ts } } } @@ -191,6 +230,9 @@ egwGridDataElement.prototype.set_data = function(_value) */ egwGridDataElement.prototype.loadData = function(_data, _doCallUpdate) { + // Store the current timestamp + EGW_GRID_DATA_UPDATE_TIME = (new Date).getTime(); + if (typeof _doCallUpdate == "undefined") { _doCallUpdate = false; @@ -287,6 +329,7 @@ egwGridDataElement.prototype.clearData = function() this.caption = false; this.iconUrl = false; this.iconSize = false; + this.capColTime = 0; this.callGridViewObjectUpdate(); } @@ -426,7 +469,8 @@ egwGridDataElement.prototype.hasColumn = function(_columnId, _returnData) { res = { "caption": this.caption, - "iconUrl": this.iconUrl + "iconUrl": this.iconUrl, + "time": this.capColTime } } else @@ -448,7 +492,7 @@ egwGridDataElement.prototype.hasColumn = function(_columnId, _returnData) { if (_returnData && typeof this.data[_columnId].data != "undefined") { - res = this.data[_columnId].data; + res = this.data[_columnId]; } else { diff --git a/phpgwapi/js/egw_action/egw_grid_view.js b/phpgwapi/js/egw_action/egw_grid_view.js index 35b2c69e64..ed592a4b27 100644 --- a/phpgwapi/js/egw_action/egw_grid_view.js +++ b/phpgwapi/js/egw_action/egw_grid_view.js @@ -1396,9 +1396,9 @@ function egwGridViewRow_doInsertIntoDOM() this.parentNode.append(td); // Assign the click event to the column - td.mousedown(egwPreventSelect); +// td.mousedown(egwPreventSelect); td.click({"item": this, "col": col.id}, function(e) { - this.onselectstart = null; +// this.onselectstart = null; e.data.item._columnClick(egwGetShiftState(e), e.data.col); }); @@ -1407,7 +1407,8 @@ function egwGridViewRow_doInsertIntoDOM() // Store the column in the td object array this.tdObjects.push({ "td": td, - "cont": cont + "cont": cont, + "ts": 0 }); } @@ -1443,6 +1444,16 @@ function egwGridViewRow_doUpdateData(_immediate) var cont = this.tdObjects[i].cont; if (typeof data[col.id] != "undefined") { + // If the timestamp of the tdObject and the data is still the + // same we don't have to update + if (this.tdObjects[i].ts == data[col.id].time) + { + continue; + } + + // Update the timestamp + this.tdObjects[i].ts = data[col.id].time; + cont.empty(); if (col.type == EGW_COL_TYPE_NAME_ICON_FIXED) @@ -1531,7 +1542,7 @@ function egwGridViewRow_doUpdateData(_immediate) } else { - cont.html(data[col.id]); + cont.html(data[col.id].data); } cont.toggleClass("queued", false); }