removed egwGridView_outer margin

This commit is contained in:
Andreas Stöckel 2011-03-30 12:28:24 +00:00
parent 019ec56408
commit 4b23d7bca2
9 changed files with 126 additions and 31 deletions

View File

@ -167,6 +167,7 @@ define("EGW_COL_TYPE_NAME_ICON_FIXED", 1);
define("EGW_COL_VISIBILITY_ALWAYS", 0); define("EGW_COL_VISIBILITY_ALWAYS", 0);
define("EGW_COL_VISIBILITY_VISIBLE", 1); define("EGW_COL_VISIBILITY_VISIBLE", 1);
define("EGW_COL_VISIBILITY_INVISIBLE", 2); define("EGW_COL_VISIBILITY_INVISIBLE", 2);
define("EGW_COL_VISIBILITY_ALWAYS_NOSELECT", 3);
define("EGW_COL_SORTABLE_NONE", 0); define("EGW_COL_SORTABLE_NONE", 0);
define("EGW_COL_SORTABLE_ALPHABETIC", 1); define("EGW_COL_SORTABLE_ALPHABETIC", 1);
@ -210,7 +211,7 @@ class egw_grid_column extends egw_json_object
public function set_visible($val) public function set_visible($val)
{ {
if ($this->visibility != EGW_COL_VISIBILITY_ALWAYS) if ($this->visibility != EGW_COL_VISIBILITY_ALWAYS && $this->visibility != EGW_COL_VISIBILITY_ALWAYS_NOSELECT)
{ {
$this->visibility = $val ? EGW_COL_VISIBILITY_VISIBLE : EGW_COL_VISIBILITY_INVISIBLE; $this->visibility = $val ? EGW_COL_VISIBILITY_VISIBLE : EGW_COL_VISIBILITY_INVISIBLE;
} }

View File

@ -128,6 +128,18 @@ function egwCallAbstract(_obj, _fn, _args)
return false; return false;
} }
function egwArraysEqual(_ar1, _ar2)
{
var result = _ar1.length == _ar2.length;
for (var i = 0; i < _ar1.length; i++)
{
result = result && (_ar1[i] == _ar2[i])
}
return result;
}
/** /**
sprintf() for JavaScript 0.6 sprintf() for JavaScript 0.6

View File

@ -32,6 +32,11 @@ _egwActionClasses["drop"] = {
"implementation": getDropImplementation "implementation": getDropImplementation
} }
function _getTopBody()
{
return $("body", window.top);
}
/** /**
* The egwDragAction class overwrites the egwAction class and adds the new * The egwDragAction class overwrites the egwAction class and adds the new
@ -112,7 +117,7 @@ function egwDragActionImplementation()
// fixes a bug in IE: If the element isn't inserted into // fixes a bug in IE: If the element isn't inserted into
// the DOM-tree jquery appends it to the parent node. // the DOM-tree jquery appends it to the parent node.
// In case this is a table it doesn't work correctly // In case this is a table it doesn't work correctly
$("body").append(ai.helper); _getTopBody().append(ai.helper);
return ai.helper; return ai.helper;
} }

View File

@ -173,3 +173,12 @@ egwGrid.prototype.reload = function()
this.gridOuter.empty(); this.gridOuter.empty();
} }
/**
* Returns the height of the data inserted into the grid
*/
egwGrid.prototype.getDataHeight = function()
{
return this.gridOuter.grid.getHeight();
}

View File

@ -26,6 +26,7 @@ var EGW_COL_TYPE_NAME_ICON_FIXED = 1;
var EGW_COL_VISIBILITY_ALWAYS = 0; var EGW_COL_VISIBILITY_ALWAYS = 0;
var EGW_COL_VISIBILITY_VISIBLE = 1; var EGW_COL_VISIBILITY_VISIBLE = 1;
var EGW_COL_VISIBILITY_INVISIBLE = 2; var EGW_COL_VISIBILITY_INVISIBLE = 2;
var EGW_COL_VISIBILITY_ALWAYS_NOSELECT = 3;
var EGW_COL_SORTABLE_NONE = 0; var EGW_COL_SORTABLE_NONE = 0;
var EGW_COL_SORTABLE_ALPHABETIC = 1; var EGW_COL_SORTABLE_ALPHABETIC = 1;
@ -141,11 +142,6 @@ egwGridColumn.prototype.set_type = function(_value)
if (typeof _value == "number" && (_value == EGW_COL_TYPE_DEFAULT || if (typeof _value == "number" && (_value == EGW_COL_TYPE_DEFAULT ||
_value == EGW_COL_TYPE_NAME_ICON_FIXED)) _value == EGW_COL_TYPE_NAME_ICON_FIXED))
{ {
if (_value == EGW_COL_TYPE_NAME_ICON_FIXED)
{
this.visibility = EGW_COL_VISIBILITY_ALWAYS;
}
this.type = _value; this.type = _value;
} }
} }
@ -157,22 +153,16 @@ egwGridColumn.prototype.set_type = function(_value)
egwGridColumn.prototype.set_visibility = function(_value) egwGridColumn.prototype.set_visibility = function(_value)
{ {
if (typeof _value == "number" && (_value == EGW_COL_VISIBILITY_ALWAYS || if (typeof _value == "number" && (_value == EGW_COL_VISIBILITY_ALWAYS ||
_value == EGW_COL_VISIBILITY_INVISIBLE || _value == EGW_COL_VISIBILITY_VISIBLE)) _value == EGW_COL_VISIBILITY_INVISIBLE || _value == EGW_COL_VISIBILITY_VISIBLE ||
_value == EGW_COL_VISIBILITY_ALWAYS_NOSELECT))
{ {
if (this.type == EGW_COL_TYPE_NAME_ICON_FIXED) if (_value != this.visibility)
{ {
this.visibility = EGW_COL_VISIBILITY_ALWAYS; this.visibility = _value;
}
else
{
if (_value != this.visibility)
{
this.visibility = _value;
if (this.visibilityChangeCallback) if (this.visibilityChangeCallback)
{ {
this.visibilityChangeCallback.call(this.context, this); this.visibilityChangeCallback.call(this.context, this);
}
} }
} }
} }
@ -518,11 +508,15 @@ egwGridColumns.prototype.getColumnVisibilitySet = function()
for (var i = 0; i < this.columns.length; i++) for (var i = 0; i < this.columns.length; i++)
{ {
result[this.columns[i].id] = { if (this.columns[i].visibility != EGW_COL_VISIBILITY_ALWAYS_NOSELECT)
"caption": this.columns[i].caption, {
"enabled": this.columns[i].visibility != EGW_COL_VISIBILITY_ALWAYS, result[this.columns[i].id] = {
"visible": this.columns[i].visibility != EGW_COL_VISIBILITY_INVISIBLE "caption": this.columns[i].caption,
}; "enabled": (this.columns[i].visibility != EGW_COL_VISIBILITY_ALWAYS) &&
(this.columns[i].type == EGW_COL_TYPE_DEFAULT),
"visible": this.columns[i].visibility != EGW_COL_VISIBILITY_INVISIBLE
};
}
} }
return result; return result;

View File

@ -60,6 +60,7 @@ function egwGridDataElement(_id, _parent, _columns, _readQueue, _objectManager)
this.caption = false; this.caption = false;
this.iconUrl = false; this.iconUrl = false;
this.iconSize = false; this.iconSize = false;
this.iconOverlay = [];
this.opened = _parent == null; this.opened = _parent == null;
this.index = 0; this.index = 0;
this.canHaveChildren = false; this.canHaveChildren = false;
@ -69,6 +70,7 @@ function egwGridDataElement(_id, _parent, _columns, _readQueue, _objectManager)
this.actionLinkGroups = {}; this.actionLinkGroups = {};
this.group = false; this.group = false;
this.capColTime = 0; this.capColTime = 0;
this.rowClass = "";
this.gridViewObj = null; this.gridViewObj = null;
} }
@ -80,6 +82,14 @@ egwGridDataElement.prototype.free = function()
//TODO //TODO
} }
egwGridDataElement.prototype.set_rowClass = function(_value)
{
if (_value != this.rowClass)
{
this.rowClass = _value;
}
}
egwGridDataElement.prototype.set_caption = function(_value) egwGridDataElement.prototype.set_caption = function(_value)
{ {
if (_value != this.caption) if (_value != this.caption)
@ -98,6 +108,16 @@ egwGridDataElement.prototype.set_iconUrl = function(_value)
} }
} }
egwGridDataElement.prototype.set_iconOverlay = function(_value)
{
if (!egwArraysEqual(_value, this.iconOverlay))
{
this.capColTime = EGW_GRID_DATA_UPDATE_TIME;
this.iconOverlay = _value;
}
}
egwGridDataElement.prototype.set_iconSize = function(_value) egwGridDataElement.prototype.set_iconSize = function(_value)
{ {
if (_value != this.iconSize) if (_value != this.iconSize)
@ -207,8 +227,9 @@ egwGridDataElement.prototype.set_data = function(_value)
* [ * [
* { * {
* ["entryType": (EGW_DATA_TYPE_ELEMENT | EGW_DATA_TYPE_RANGE)] // Defaults to EGW_DATA_TYPE_ELEMENT * ["entryType": (EGW_DATA_TYPE_ELEMENT | EGW_DATA_TYPE_RANGE)] // Defaults to EGW_DATA_TYPE_ELEMENT
* "type": "[Typeclass]" // Typeclass of the view-container: specifies the chars after the egwGridView-prefix. Defaults to "Row" which becomes "egwGridViewRow" * "type": "[Typeclass]" // Typeclass of the view-container: specifies the chars after the egwGridView-prefix. Defaults to "Row" which becomes "egwGridViewRow",
* IF EGW_DATA_TYPE_ELEMENT: * IF EGW_DATA_TYPE_ELEMENT:
* "id": [ Name of the element ]
* "children": [ Objects which will be added to the children of the element ] * "children": [ Objects which will be added to the children of the element ]
* ELEMENT DATA // See below * ELEMENT DATA // See below
IF EGW_DATA_TYPE_RANGE: IF EGW_DATA_TYPE_RANGE:
@ -217,7 +238,10 @@ egwGridDataElement.prototype.set_data = function(_value)
* } * }
* ] * ]
* *
* 2. If an object with element dara is passed, the properties of the element will * 2. If a string or number is passed, inside an array, it is encapsulated into
* an empty entry with that id
*
* 3. If an object with element dara is passed, the properties of the element will
* be updated to the given values. * be updated to the given values.
* *
* { * {
@ -247,6 +271,15 @@ egwGridDataElement.prototype.loadData = function(_data, _doCallUpdate)
{ {
var entry = _data[i]; var entry = _data[i];
// Single string entries are automatically converted to an entry
// with that id
if (typeof entry == String || typeof entry == Number)
{
entry = {
"id": (entry + '') // The "+ ''" converts the entry to a string
}
}
if (entry.constructor != Object) if (entry.constructor != Object)
{ {
continue; continue;

View File

@ -1295,6 +1295,7 @@ function egwGridViewRow(_grid, _heightChangeProc, _item)
container.containerClass = "row"; container.containerClass = "row";
container.childGrid = null; container.childGrid = null;
container.opened = false; container.opened = false;
container.rowClass = "";
// Overwrite the inherited abstract functions // Overwrite the inherited abstract functions
container.doInsertIntoDOM = egwGridViewRow_doInsertIntoDOM; container.doInsertIntoDOM = egwGridViewRow_doInsertIntoDOM;
@ -1433,6 +1434,19 @@ function egwGridViewRow_doUpdateData(_immediate)
var data = this.item.getData(ids); var data = this.item.getData(ids);
var vis_idx = 0; var vis_idx = 0;
// Set the row class
if (this.rowClass != this.item.rowClass)
{
if (this.rowClass != "")
{
this.parentNode.removeClass(this.rowClass);
}
this.parentNode.addClass(this.item.rowClass);
this.rowClass = this.item.rowClass;
}
// Set the column data
for (var i = 0; i < this.tdObjects.length; i++) for (var i = 0; i < this.tdObjects.length; i++)
{ {
var col = this.columns[i]; var col = this.columns[i];
@ -1509,6 +1523,9 @@ function egwGridViewRow_doUpdateData(_immediate)
iconContainer.css("min-height", this.grid.avgIconHeight + "px"); iconContainer.css("min-height", this.grid.avgIconHeight + "px");
// Build the icon // Build the icon
var overlayCntr = $(document.createElement("span"));
overlayCntr.addClass("iconOverlayContainer");
var icon = $(document.createElement("img")); var icon = $(document.createElement("img"));
if (this.item.iconSize) if (this.item.iconSize)
{ {
@ -1526,8 +1543,18 @@ function egwGridViewRow_doUpdateData(_immediate)
}, 100); }, 100);
e.data.item.callHeightChangeProc(); e.data.item.callHeightChangeProc();
}); });
overlayCntr.append(icon);
for (var i = 0; i < this.item.iconOverlay.length; i++)
{
var overlay = $(document.createElement("img"));
overlay.addClass("overlay");
overlay.attr("src", this.item.iconOverlay[i]);
overlayCntr.append(overlay);
}
icon.addClass("icon"); icon.addClass("icon");
iconContainer.append(icon); iconContainer.append(overlayCntr);
cont.append(iconContainer); cont.append(iconContainer);
} }

View File

@ -242,6 +242,7 @@
] ]
); );
grid.resize(1500, 500); grid.resize(1500, 500);
grid.reload();
}); });
function check_positions(_grid, _delta) function check_positions(_grid, _delta)

View File

@ -595,7 +595,7 @@ Preferences tabs
border-spacing: 0; border-spacing: 0;
border-collapse: collapse; border-collapse: collapse;
padding: 0; padding: 0;
margin: 5px; /* margin: 5px;*/
} }
.egwGridView_outer td, .egwGridView_outer tr { .egwGridView_outer td, .egwGridView_outer tr {
@ -645,12 +645,25 @@ Preferences tabs
vertical-align: middle; vertical-align: middle;
} }
.egwGridView_grid img.icon { .egwGridView_grid span.iconOverlayContainer {
vertical-align: middle;
margin: 2px 5px 2px 2px; margin: 2px 5px 2px 2px;
position: relative;
-moz-user-select: none; -moz-user-select: none;
-khtml-user-select: none; -khtml-user-select: none;
user-select: none; user-select: none;
overflow: visible;
}
.egwGridView_grid span.iconOverlayContainer img.overlay {
position: absolute;
right: -2px;
bottom: -2px;
vertical-align: bottom;
}
.egwGridView_grid img.icon {
vertical-align: middle;
margin: 0;
} }
.egwGridView_grid span.arrow { .egwGridView_grid span.arrow {