mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
Added subgrid support to nm
This commit is contained in:
parent
1d405d05ba
commit
a8ed2af938
@ -548,6 +548,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
||||
this.egw(),
|
||||
this.getInstanceManager().etemplate_exec_id,
|
||||
"nm",
|
||||
null,
|
||||
this.dataview.grid,
|
||||
this.rowProvider,
|
||||
this.options.settings.action_links,
|
||||
@ -580,6 +581,28 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
||||
}
|
||||
},
|
||||
|
||||
_getSubgrid: function (_row, _parentId) {
|
||||
// Create a new grid with the row as parent and the dataview grid as
|
||||
// parent grid
|
||||
var grid = new et2_dataview_grid(_row, this.dataview.grid);
|
||||
|
||||
// Create a new controller for the grid
|
||||
var controller = new et2_nextmatch_controller(
|
||||
this.egw(),
|
||||
this.getInstanceManager().etemplate_exec_id,
|
||||
"nm",
|
||||
_parentId,
|
||||
grid,
|
||||
this.rowProvider,
|
||||
this.options.settings.action_links,
|
||||
null,
|
||||
this.options.settings.actions
|
||||
);
|
||||
controller.update();
|
||||
|
||||
return grid;
|
||||
},
|
||||
|
||||
_getInitialOrder: function (_rows, _rowId) {
|
||||
|
||||
var _order = [];
|
||||
|
@ -43,7 +43,7 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
|
||||
* @param _actions contains the actions, may be null if an object manager
|
||||
* is given.
|
||||
*/
|
||||
init: function (_egw, _execId, _widgetId, _grid, _rowProvider,
|
||||
init: function (_egw, _execId, _widgetId, _parentId, _grid, _rowProvider,
|
||||
_actionLinks, _objectManager, _actions) {
|
||||
|
||||
// Copy the egw reference
|
||||
@ -68,6 +68,7 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
|
||||
this._actionLinks = _actionLinks
|
||||
this._execId = _execId;
|
||||
this._widgetId = _widgetId;
|
||||
this._parentId = _parentId;
|
||||
this._rowProvider = _rowProvider;
|
||||
|
||||
// We start with no filters
|
||||
@ -179,6 +180,13 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
|
||||
|
||||
|
||||
dataFetch: function (_queriedRange, _callback, _context) {
|
||||
|
||||
// Merge the parent id into the _queriedRange if it is set
|
||||
if (this._parentId !== null)
|
||||
{
|
||||
_queriedRange["parent_id"] = _queriedRange;
|
||||
}
|
||||
|
||||
// Pass the fetch call to the API, multiplex the data about the
|
||||
// nextmatch instance into the call.
|
||||
this.egw.dataFetch(
|
||||
|
@ -27,9 +27,11 @@ var et2_nextmatch_rowProvider = Class.extend({
|
||||
/**
|
||||
* Creates the nextmatch row provider.
|
||||
*/
|
||||
init: function (_rowProvider) {
|
||||
init: function (_rowProvider, _subgridCallback, _context) {
|
||||
// Copy the arguments
|
||||
this._rowProvider = _rowProvider;
|
||||
this._subgridCallback = _subgridCallback;
|
||||
this._context = _context;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -160,6 +162,15 @@ var et2_nextmatch_rowProvider = Class.extend({
|
||||
var tr = _row.getDOMNode();
|
||||
tr.appendChild(row);
|
||||
|
||||
// Make the row expandable
|
||||
if (typeof _data["is_parent"] !== "undefined" && _data["is_parent"])
|
||||
{
|
||||
_row.makeExpandable(true, function () {
|
||||
return this._subgridCallback.call(this._context,
|
||||
_row, _data["parent_id"]);
|
||||
}, this);
|
||||
}
|
||||
|
||||
// Set the row data
|
||||
this._setRowData(this._template.rowData, tr, mgrs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user