forked from extern/egroupware
Implement updating just the affected nm row with egw_refresh()
This commit is contained in:
parent
a3647e1b00
commit
298309074e
@ -218,6 +218,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
if (($row_id = $value['row_id']) && $queriedRange['refresh'])
|
if (($row_id = $value['row_id']) && $queriedRange['refresh'])
|
||||||
{
|
{
|
||||||
$value['col_filter'][$row_id] = $queriedRange['refresh'];
|
$value['col_filter'][$row_id] = $queriedRange['refresh'];
|
||||||
|
$value['csv_export'] = 'refresh';
|
||||||
}
|
}
|
||||||
$rows = $result['data'] = $result['order'] = array();
|
$rows = $result['data'] = $result['order'] = array();
|
||||||
$result['total'] = self::call_get_rows($value, $rows, $result['readonlys']);
|
$result['total'] = self::call_get_rows($value, $rows, $result['readonlys']);
|
||||||
@ -227,10 +228,10 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
$row_modified = $value['row_modified'];
|
$row_modified = $value['row_modified'];
|
||||||
$is_parent = $value['is_parent'];
|
$is_parent = $value['is_parent'];
|
||||||
|
|
||||||
$kUkey = false;
|
|
||||||
|
|
||||||
foreach($rows as $n => $row)
|
foreach($rows as $n => $row)
|
||||||
{
|
{
|
||||||
|
$kUkey = false;
|
||||||
if (is_int($n) && $row)
|
if (is_int($n) && $row)
|
||||||
{
|
{
|
||||||
if (!isset($row[$row_id])) unset($row_id); // unset default row_id of 'id', if not used
|
if (!isset($row[$row_id])) unset($row_id); // unset default row_id of 'id', if not used
|
||||||
@ -267,7 +268,9 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
{
|
{
|
||||||
foreach($knownUids as $uid)
|
foreach($knownUids as $uid)
|
||||||
{
|
{
|
||||||
$result['data'][$uid] = null;
|
// Just don't send it back for now
|
||||||
|
unset($result['data'][$uid]);
|
||||||
|
//$result['data'][$uid] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*else
|
/*else
|
||||||
|
@ -460,7 +460,9 @@ var et2_dataview_controller = Class.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Called by the data source when the data changes
|
||||||
|
*
|
||||||
|
* @param _data Object|null New data, or null. Null will remove the row.
|
||||||
*/
|
*/
|
||||||
_dataCallback: function (_data) {
|
_dataCallback: function (_data) {
|
||||||
// Set the "hasData" flag
|
// Set the "hasData" flag
|
||||||
@ -473,6 +475,13 @@ var et2_dataview_controller = Class.extend({
|
|||||||
// Remove everything from the current row
|
// Remove everything from the current row
|
||||||
this.entry.row.clear();
|
this.entry.row.clear();
|
||||||
|
|
||||||
|
// If there's no data, stop
|
||||||
|
if(typeof _data == "undefined" || _data == null)
|
||||||
|
{
|
||||||
|
this._destroyCallback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fill the row DOM Node with data
|
// Fill the row DOM Node with data
|
||||||
this.self._rowCallback.call(
|
this.self._rowCallback.call(
|
||||||
this.self._context,
|
this.self._context,
|
||||||
|
@ -480,7 +480,7 @@ etemplate2.prototype.getValues = function(_root)
|
|||||||
* @see jsapi.egw_refresh()
|
* @see jsapi.egw_refresh()
|
||||||
* @see egw_fw.egw_refresh()
|
* @see egw_fw.egw_refresh()
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype.refresh = function(msg, id, type)
|
etemplate2.prototype.refresh = function(msg, app, id, type)
|
||||||
{
|
{
|
||||||
// We use et2_baseWidget in case the app uses something like HTML instead of label
|
// We use et2_baseWidget in case the app uses something like HTML instead of label
|
||||||
var msg_widget = this.widgetContainer.getWidgetById("msg");
|
var msg_widget = this.widgetContainer.getWidgetById("msg");
|
||||||
@ -494,18 +494,35 @@ etemplate2.prototype.refresh = function(msg, id, type)
|
|||||||
$j(msg_widget.getDOMNode()).parents().show();
|
$j(msg_widget.getDOMNode()).parents().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use jsapi data module to update
|
||||||
this.widgetContainer.iterateOver(function(_widget) {
|
var uid = app + "::" + id;
|
||||||
// TODO: This is not quite right - will restrict to just this one row
|
var update = false;
|
||||||
/*
|
switch(type)
|
||||||
if(_widget.options.settings && _widget.options.settings.row_id)
|
{
|
||||||
{
|
case "update":
|
||||||
_widget.activeFilters[_widget.options.settings.row_id] = id;
|
if(!egw(app).dataRefreshUID(uid))
|
||||||
}
|
{
|
||||||
*/
|
// Could not update just that row
|
||||||
// Trigger refresh
|
this.widgetContainer.iterateOver(function(_widget) {
|
||||||
_widget.applyFilters();
|
// Trigger refresh
|
||||||
}, this, et2_nextmatch);
|
_widget.applyFilters();
|
||||||
|
}, this, et2_nextmatch);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "delete":
|
||||||
|
// Blank the row
|
||||||
|
egw().dataStoreUID(uid,null);
|
||||||
|
// Stop caring about this ID
|
||||||
|
egw().dataUnregisterUID(uid);
|
||||||
|
break;
|
||||||
|
case "add":
|
||||||
|
default:
|
||||||
|
this.widgetContainer.iterateOver(function(_widget) {
|
||||||
|
// Trigger refresh
|
||||||
|
_widget.applyFilters();
|
||||||
|
}, this, et2_nextmatch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some static things to make getting into widget context a little easier //
|
// Some static things to make getting into widget context a little easier //
|
||||||
|
Loading…
Reference in New Issue
Block a user