mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 09:28:29 +01:00
Small design improvements, fixed horz. scrollbar in grid with chrome, ie compatibility, enabled column selection, fixed prefetch code
This commit is contained in:
parent
83bbea7669
commit
ebd6031ecf
@ -987,6 +987,13 @@ egwActionObject.prototype.updateActionLinks = function(_actionLinks, _recursive,
|
||||
for (var i = 0; i < _actionLinks.length; i++)
|
||||
{
|
||||
var elem = _actionLinks[i];
|
||||
|
||||
// Allow single strings for simple action links.
|
||||
if (typeof elem == "string")
|
||||
{
|
||||
elem = {"actionId": elem};
|
||||
}
|
||||
|
||||
if (typeof elem.actionId != "undefined" && elem.actionId)
|
||||
{
|
||||
//Get the action link object, if it doesn't exist yet, create it
|
||||
|
@ -65,9 +65,18 @@ function egwPopupActionImplementation()
|
||||
if (node)
|
||||
{
|
||||
node.ondblclick = function(e) {
|
||||
if (typeof document.selection != "undefined" && typeof document.selection.empty != "undefined")
|
||||
{
|
||||
document.selection.empty();
|
||||
}
|
||||
else if( typeof window.getSelection != "undefined")
|
||||
{
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
}
|
||||
|
||||
_callback.call(_context, "default", ai);
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ function egwGrid(_parentNode, _columns, _objectManager, _fetchCallback, _context
|
||||
// Create the outer view component and pass the dataRoot element so that
|
||||
// the grid outer element will be capable of fetching the root data and
|
||||
// can create a spacer for that.
|
||||
this.gridOuter = new egwGridViewOuter(_parentNode, this.dataRoot);
|
||||
this.gridOuter = new egwGridViewOuter(_parentNode, this.dataRoot, this.selectcolsClick, this);
|
||||
this.gridOuter.updateColumns(this.columns.getColumnData());
|
||||
}
|
||||
|
||||
@ -48,6 +48,32 @@ egwGrid.prototype.setActionLinkGroup = function(_group, _links)
|
||||
this.dataRoot.actionLinkGroups[_group] = _links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the action link groups.
|
||||
*
|
||||
* @param object _groups is an object used as associative array, which will be
|
||||
* merged into the existing actionLinkGroups
|
||||
* @param boolean _replace specifies whether existing action link groups will
|
||||
* be deleted. Defaults to false.
|
||||
*/
|
||||
egwGrid.prototype.setActionLinkGroups = function(_groups, _replace)
|
||||
{
|
||||
if (typeof _replace == "undefined")
|
||||
{
|
||||
_replace = false;
|
||||
}
|
||||
|
||||
if (_replace)
|
||||
{
|
||||
this.dataRoot.actionLinkGroups = {};
|
||||
}
|
||||
|
||||
for (var k in _groups)
|
||||
{
|
||||
this.dataRoot.actionLinkGroups[k] = _groups[k];
|
||||
}
|
||||
}
|
||||
|
||||
egwGrid.prototype.resize = function(_w, _h)
|
||||
{
|
||||
if (_w != this.width)
|
||||
@ -78,6 +104,42 @@ egwGrid.prototype.columnsUpdate = function(_column)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the selectcols callback
|
||||
*/
|
||||
egwGrid.prototype.selectcolsClick = function(_at)
|
||||
{
|
||||
var column_data = this.columns.getColumnVisibilitySet();
|
||||
|
||||
// Create a menu which contains these elements and show it
|
||||
var menu_data = [];
|
||||
for (var k in column_data)
|
||||
{
|
||||
var col = column_data[k];
|
||||
|
||||
menu_data.push(
|
||||
{
|
||||
"id": k,
|
||||
"caption": col.caption,
|
||||
"enabled": col.enabled,
|
||||
"checkbox": true,
|
||||
"checked": col.visible
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var menu = new egwMenu();
|
||||
menu.loadStructure(menu_data);
|
||||
|
||||
var self = this;
|
||||
menu.setGlobalOnClick(function(_elem) {
|
||||
column_data[_elem.id].visible = _elem.checked;
|
||||
self.columns.setColumnVisibilitySet(column_data);
|
||||
});
|
||||
|
||||
menu.showAt(_at.offset().left, _at.offset().top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emptys the grid
|
||||
*/
|
||||
|
@ -158,11 +158,12 @@ egwGridColumn.prototype.set_visibility = function(_value)
|
||||
{
|
||||
if (_value != this.visibility)
|
||||
{
|
||||
this.visibility = _value;
|
||||
|
||||
if (this.visibilityChangeCallback)
|
||||
{
|
||||
this.visibilityChangeCallback.call(this.context, this);
|
||||
}
|
||||
this.visibility = _value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -425,19 +426,30 @@ egwGridColumns.prototype.getColumnVisibilitySet = function()
|
||||
"visible": this.columns[i].visibility != EGW_COL_VISIBILITY_INVISIBLE
|
||||
};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
egwGridColumns.prototype.setColumnVisibilitySet = function(_set)
|
||||
{
|
||||
this._beginUpdate();
|
||||
|
||||
for (k in _set)
|
||||
{
|
||||
var col = this.getColumnById(k);
|
||||
if (col)
|
||||
{
|
||||
col.set_visibility(col.visible ? EGW_COL_VISIBILITY_VISIBLE :
|
||||
col.set_visibility(_set[k].visible ? EGW_COL_VISIBILITY_VISIBLE :
|
||||
EGW_COL_VISIBILITY_INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.visibilityChanged)
|
||||
{
|
||||
this._calculateWidths();
|
||||
}
|
||||
|
||||
this._endUpdate();
|
||||
}
|
||||
|
||||
egwGridColumns.prototype.getColumnData = function()
|
||||
|
@ -488,7 +488,7 @@ egwGridDataElement.prototype.getData = function(_columnIds)
|
||||
|
||||
for (var i = 0; i < _columnIds.length; i++)
|
||||
{
|
||||
res = this.hasColumn(_columnIds[i], true);
|
||||
var res = this.hasColumn(_columnIds[i], true);
|
||||
|
||||
// Either add the result to the result list (if the column data was available)
|
||||
// or add it to the query list.
|
||||
@ -853,7 +853,7 @@ egwGridDataQueue.prototype.prefetch = function(_cnt)
|
||||
{
|
||||
var idx = planes[plane].idx;
|
||||
|
||||
if (!planes.parent || idx == planes[plane].parent.children.length)
|
||||
if (!planes[plane].parent || idx == planes[plane].parent.children.length)
|
||||
{
|
||||
planes[plane].done = true;
|
||||
done++;
|
||||
@ -864,7 +864,7 @@ egwGridDataQueue.prototype.prefetch = function(_cnt)
|
||||
var elem = planes[plane].parent.children[idx];
|
||||
for (var j = 0; j < this.queueColumns.length; j++)
|
||||
{
|
||||
if (!elem.hasColumn(this.queueColumns[i], false))
|
||||
if (!elem.hasColumn(this.queueColumns[j], false))
|
||||
{
|
||||
hasData = false;
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ var EGW_GRID_SCROLLBAR_WIDTH = false;
|
||||
* @param object _data is the data-provider object which contains/loads the grid rows
|
||||
* and contains their data.
|
||||
*/
|
||||
function egwGridViewOuter(_parentNode, _dataRoot)
|
||||
function egwGridViewOuter(_parentNode, _dataRoot, _selectColsCallback, _context)
|
||||
{
|
||||
this.parentNode = $(_parentNode);
|
||||
this.dataRoot = _dataRoot;
|
||||
@ -93,6 +93,8 @@ function egwGridViewOuter(_parentNode, _dataRoot)
|
||||
this.scrollbarWidth = 0;
|
||||
|
||||
this.headerColumns = [];
|
||||
this.selectColsCallback = _selectColsCallback;
|
||||
this.context = _context;
|
||||
|
||||
this.buildBase();
|
||||
this.parentNode.append(this.outer_table);
|
||||
@ -216,7 +218,7 @@ egwGridViewOuter.prototype.buildBaseHeader = function()
|
||||
|
||||
for (var i = 0; i < this.columns.length; i++)
|
||||
{
|
||||
col = this.columns[i];
|
||||
var col = this.columns[i];
|
||||
|
||||
// Create the column element and insert it into the DOM-Tree
|
||||
var column = $(document.createElement("th"));
|
||||
@ -237,6 +239,13 @@ egwGridViewOuter.prototype.buildBaseHeader = function()
|
||||
this.optcol.css("width", this.scrollbarWidth - this.optcol.outerWidth()
|
||||
+ this.optcol.width() + 1); // The "1" is a "security pixel" which prevents a horizontal scrollbar form occuring on IE7
|
||||
|
||||
var self = this;
|
||||
this.selectcols.click(function() {
|
||||
self.selectColsCallback.call(self.context, self.selectcols);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
this.headerHeight = this.outer_thead.height();
|
||||
}
|
||||
|
||||
@ -814,12 +823,14 @@ function egwGridViewGrid_updateAssumedHeights(_maxCount)
|
||||
|
||||
function egwGridViewGrid_insertContainer(_after, _class, _params)
|
||||
{
|
||||
this.beginUpdate();
|
||||
var container = null;
|
||||
|
||||
try
|
||||
{
|
||||
this.beginUpdate();
|
||||
this.didUpdate = true;
|
||||
|
||||
var container = new _class(this, this.heightChangeHandler, _params);
|
||||
container = new _class(this, this.heightChangeHandler, _params);
|
||||
|
||||
var idx = this.children.length;
|
||||
if (typeof _after == "number")
|
||||
@ -864,15 +875,13 @@ function egwGridViewGrid_insertContainer(_after, _class, _params)
|
||||
this.children[i].offsetPosition(height);
|
||||
this.children[i].index++;
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.endUpdate();
|
||||
}
|
||||
|
||||
this.callHeightChangeProc();
|
||||
return container;
|
||||
}
|
||||
|
||||
function egwGridViewGrid_removeContainer(_container)
|
||||
@ -1219,7 +1228,7 @@ function egwGridViewRow_doUpdateData(_immediate)
|
||||
ids.push(this.columns[i].id);
|
||||
}
|
||||
|
||||
data = this.item.getData(ids);
|
||||
var data = this.item.getData(ids);
|
||||
|
||||
for (var i = 0; i < this.tdObjects.length; i++)
|
||||
{
|
||||
@ -1237,7 +1246,7 @@ function egwGridViewRow_doUpdateData(_immediate)
|
||||
// Build the indentation object
|
||||
var indentation = $(document.createElement("span"));
|
||||
indentation.addClass("indentation");
|
||||
indentation.css("width", (depth * 12) + "px");
|
||||
indentation.css("width", (depth * 20) + "px");
|
||||
td.append(indentation);
|
||||
}
|
||||
|
||||
@ -1272,23 +1281,26 @@ function egwGridViewRow_doUpdateData(_immediate)
|
||||
// Insert the icon
|
||||
if (data[col.id].iconUrl)
|
||||
{
|
||||
// Build the icon element
|
||||
// Build the icon container
|
||||
var iconContainer = $(document.createElement("span"));
|
||||
iconContainer.addClass("iconContainer " + this.grid.uniqueId);
|
||||
var icon = $(document.createElement("img"));
|
||||
|
||||
// Default the image height to the average height - this attribute
|
||||
// Default the iconContainer height to the average height - this attribute
|
||||
// is removed from the row as soon as the icon is loaded
|
||||
var height = this.item.iconSize ? this.item.iconSize : this.grid.avgIconHeight;
|
||||
icon.attr("height", Math.round(height));
|
||||
iconContainer.css("min-height", this.grid.avgIconHeight + "px");
|
||||
|
||||
// Build the icon
|
||||
var icon = $(document.createElement("img"));
|
||||
if (this.item.iconSize)
|
||||
{
|
||||
icon.css("height", this.item.iconSize + "px");
|
||||
icon.css("width", this.item.iconSize + "px"); //has to be done because of IE :-(
|
||||
}
|
||||
icon.attr("src", data[col.id].iconUrl);
|
||||
|
||||
icon.load({"item": this, "col": td}, function(e) {
|
||||
icon.load({"item": this, "col": td, "cntr": iconContainer}, function(e) {
|
||||
e.data.cntr.css("min-height", "");
|
||||
var icon = $(this);
|
||||
if (!e.data.item.item.iconSize)
|
||||
{
|
||||
icon.removeAttr("height");
|
||||
}
|
||||
window.setTimeout(function() {
|
||||
e.data.item.grid.setIconWidth(icon.width());
|
||||
e.data.item.grid.addIconHeightToAvg(icon.height());
|
||||
@ -1583,7 +1595,7 @@ function egwGridViewFullRow_doUpdateData(_immediate)
|
||||
// Build the indentation object
|
||||
var indentation = $(document.createElement("span"));
|
||||
indentation.addClass("indentation");
|
||||
indentation.css("width", (depth * 12) + "px");
|
||||
indentation.css("width", (depth * 20) + "px");
|
||||
this.td.append(indentation);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,8 @@ function egwDynStyleSheet()
|
||||
this.selectorCount = 0;
|
||||
|
||||
EGW_DYNAMIC_STYLESHEET = this;
|
||||
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -177,7 +177,9 @@ body, td, th {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.frame {
|
||||
.egwGridView_grid td.frame,
|
||||
.egwGridView_outer td.frame,
|
||||
.egwGridView_grid td.egwGridView_spacer {
|
||||
padding: 0 !important;
|
||||
border-right: 0 none silver !important;
|
||||
border-bottom: 0 none silver !important;
|
||||
|
@ -61,8 +61,6 @@ div.dhtmlxMenu_egw_TopLevel_Item_Disabled,
|
||||
div.dhtmlxMenu_egw_TopLevel_Item_Selected {
|
||||
position: relative;
|
||||
float: left;
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
cursor: default;
|
||||
white-space: nowrap;
|
||||
@ -187,8 +185,6 @@ div.dhtmlxMenu_egw_SubLevelArea_Polygon table.dhtmlxMebu_SubLevelArea_Tbl td.sub
|
||||
padding-right: 4px;
|
||||
}
|
||||
div.dhtmlxMenu_egw_SubLevelArea_Polygon table.dhtmlxMebu_SubLevelArea_Tbl div.sub_item_text {
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
@ -202,8 +198,6 @@ div.dhtmlxMenu_egw_SubLevelArea_Polygon table.dhtmlxMebu_SubLevelArea_Tbl td.sub
|
||||
padding-right: 8px;
|
||||
}
|
||||
div.dhtmlxMenu_egw_SubLevelArea_Polygon table.dhtmlxMebu_SubLevelArea_Tbl td.sub_item_hk div.sub_item_hk {
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 11px;
|
||||
color: #a4bed4;
|
||||
text-align: right;
|
||||
}
|
||||
@ -303,8 +297,6 @@ div.dhtmlxMenu_egw_SubLevelArea_ArrowDown_Disabled div.dhtmlxMenu_SubLevelArea_A
|
||||
vertical-align: middle;
|
||||
left: none;
|
||||
right: 8px;
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 11px;
|
||||
color: #000000;
|
||||
cursor: default;
|
||||
}
|
||||
@ -316,8 +308,6 @@ div.dhtmlxMenu_egw_SubLevelArea_ArrowDown_Disabled div.dhtmlxMenu_SubLevelArea_A
|
||||
vertical-align: middle;
|
||||
right: none;
|
||||
left: 8px;
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 11px;
|
||||
color: #000000;
|
||||
cursor: default;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@
|
||||
"entryType": EGW_DATA_TYPE_RANGE,
|
||||
"prefix": "root_elem_",
|
||||
"canHaveChildren": true,
|
||||
"count": 1000
|
||||
"count": 10
|
||||
}
|
||||
]
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user