Implemented new selectmode in grid, added grid.setSelectmode method to set the selectmode

This commit is contained in:
Andreas Stöckel 2011-06-15 16:31:33 +00:00
parent 48221b6bc2
commit 1c600b919d
2 changed files with 25 additions and 4 deletions

View File

@ -18,7 +18,8 @@ uses
egw_action_columns
*/
function egwGrid(_parentNode, _columns, _objectManager, _fetchCallback, _columnChangeCallback, _context)
function egwGrid(_parentNode, _columns, _objectManager, _fetchCallback,
_columnChangeCallback, _context)
{
this.parentNode = _parentNode;
this.objectManager = _objectManager;
@ -66,6 +67,14 @@ function egwGrid(_parentNode, _columns, _objectManager, _fetchCallback, _columnC
this.gridOuter.updateColumns(this.columns.getColumnData());
}
var EGW_SELECTMODE_DEFAULT = 0;
var EGW_SELECTMODE_TOGGLE = 1;
egwGrid.prototype.setSelectmode = function(_mode)
{
this.gridOuter.grid.selectmode = _mode;
}
egwGrid.prototype.setActionLinkGroup = function(_group, _links)
{
this.dataRoot.actionLinkGroups[_group] = _links;

View File

@ -854,6 +854,9 @@ function egwGridViewGrid(_grid, _heightChangeProc, _scrollable, _outer)
container.doInsertIntoDOM = egwGridViewGrid_doInsertIntoDOM;
container.doSetViewArea = egwGridViewGrid_doSetviewArea;
// Set the default selectmode
container.selectmode = EGW_SELECTMODE_DEFAULT;
return container;
}
@ -1494,9 +1497,18 @@ function egwGridViewRow__columnClick(_shiftState, _column)
var state = this.aoi.getState();
var isSelected = egwBitIsSet(state, EGW_AO_STATE_SELECTED);
this.aoi.updateState(EGW_AO_STATE_SELECTED,
!egwBitIsSet(_shiftState, EGW_AO_SHIFT_STATE_MULTI) || !isSelected,
_shiftState);
switch (this.grid.selectmode)
{
case EGW_SELECTMODE_DEFAULT:
this.aoi.updateState(EGW_AO_STATE_SELECTED,
!egwBitIsSet(_shiftState, EGW_AO_SHIFT_STATE_MULTI) || !isSelected,
_shiftState);
break;
case EGW_SELECTMODE_TOGGLE:
this.aoi.updateState(EGW_AO_STATE_SELECTED, !isSelected,
egwSetBit(EGW_AO_SHIFT_STATE_MULTI, _shiftState, true));
break;
}
}
function egwGridViewRow__checkboxClick()