mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-28 16:59:36 +01:00
Preserve expanded sub-grids across refresh
This commit is contained in:
parent
cc54a57b25
commit
f5010b880b
@ -86,6 +86,7 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider,
|
|||||||
// Keep selection across filter changes
|
// Keep selection across filter changes
|
||||||
this.kept_selection = null;
|
this.kept_selection = null;
|
||||||
this.kept_focus = null;
|
this.kept_focus = null;
|
||||||
|
this.kept_expansion = [];
|
||||||
|
|
||||||
// Directly use the API-Implementation of dataRegisterUID and
|
// Directly use the API-Implementation of dataRegisterUID and
|
||||||
// dataUnregisterUID
|
// dataUnregisterUID
|
||||||
@ -121,6 +122,17 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider,
|
|||||||
this.kept_selection = this._selectionMgr ? this._selectionMgr.getSelected() : null;
|
this.kept_selection = this._selectionMgr ? this._selectionMgr.getSelected() : null;
|
||||||
this.kept_focus = this._selectionMgr && this._selectionMgr._focusedEntry ?
|
this.kept_focus = this._selectionMgr && this._selectionMgr._focusedEntry ?
|
||||||
this._selectionMgr._focusedEntry.uid || null : null;
|
this._selectionMgr._focusedEntry.uid || null : null;
|
||||||
|
|
||||||
|
// Find expanded rows
|
||||||
|
var nm = this._widget;
|
||||||
|
var controller = this;
|
||||||
|
$j('.arrow.opened',this._widget.getDOMNode(this._widget)).each(function() {
|
||||||
|
var entry = controller.getRowByNode(this);
|
||||||
|
if(entry && entry.uid)
|
||||||
|
{
|
||||||
|
controller.kept_expansion.push(entry.uid);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getObjectManager: function () {
|
getObjectManager: function () {
|
||||||
@ -370,6 +382,8 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider,
|
|||||||
{
|
{
|
||||||
this.self._selectionMgr.setFocused(this.self.kept_focus,true);
|
this.self._selectionMgr.setFocused(this.self.kept_focus,true);
|
||||||
}
|
}
|
||||||
|
// Re-expanding rows handled in et2_extension_nextmatch_rowProvider
|
||||||
|
// Expansions might still be valid, so we don't clear them
|
||||||
this.self.kept_selection = null;
|
this.self.kept_selection = null;
|
||||||
this.self.kept_focus = null;
|
this.self.kept_focus = null;
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,25 @@ var et2_nextmatch_rowProvider = ClassWithAttributes.extend(
|
|||||||
return this._subgridCallback.call(this._context,
|
return this._subgridCallback.call(this._context,
|
||||||
_row, _data, _controller);
|
_row, _data, _controller);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
// Check for kept expansion, and set the row up to be re-expanded
|
||||||
|
// Only the top controller tracks expanded, including sub-grids
|
||||||
|
var top_controller = _controller;
|
||||||
|
while(top_controller._parentController != null)
|
||||||
|
{
|
||||||
|
top_controller = top_controller._parentController;
|
||||||
|
}
|
||||||
|
var expansion_index = top_controller.kept_expansion.indexOf(
|
||||||
|
top_controller.dataStorePrefix + '::' + _data.content[this._context.settings.row_id]
|
||||||
|
);
|
||||||
|
if(top_controller.kept_expansion && expansion_index >=0)
|
||||||
|
{
|
||||||
|
top_controller.kept_expansion.splice(expansion_index,1);
|
||||||
|
// Use a timeout since the DOM nodes might not be finished yet
|
||||||
|
window.setTimeout(function() {
|
||||||
|
_row.expansionButton.trigger('click');
|
||||||
|
},ET2_GRID_INVALIDATE_TIMEOUT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the row data
|
// Set the row data
|
||||||
|
Loading…
Reference in New Issue
Block a user