Small design improvements, fixed horz. scrollbar in grid with chrome, ie compatibility, enabled column selection, fixed prefetch code

This commit is contained in:
Andreas Stöckel
2011-03-16 17:50:25 +00:00
parent 83bbea7669
commit ebd6031ecf
10 changed files with 135 additions and 39 deletions

View File

@@ -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
*/