mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
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'])
|
||||
{
|
||||
$value['col_filter'][$row_id] = $queriedRange['refresh'];
|
||||
$value['csv_export'] = 'refresh';
|
||||
}
|
||||
$rows = $result['data'] = $result['order'] = array();
|
||||
$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'];
|
||||
$is_parent = $value['is_parent'];
|
||||
|
||||
$kUkey = false;
|
||||
|
||||
foreach($rows as $n => $row)
|
||||
{
|
||||
$kUkey = false;
|
||||
if (is_int($n) && $row)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$result['data'][$uid] = null;
|
||||
// Just don't send it back for now
|
||||
unset($result['data'][$uid]);
|
||||
//$result['data'][$uid] = null;
|
||||
}
|
||||
}
|
||||
/*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) {
|
||||
// Set the "hasData" flag
|
||||
@ -473,6 +475,13 @@ var et2_dataview_controller = Class.extend({
|
||||
// Remove everything from the current row
|
||||
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
|
||||
this.self._rowCallback.call(
|
||||
this.self._context,
|
||||
|
@ -480,7 +480,7 @@ etemplate2.prototype.getValues = function(_root)
|
||||
* @see jsapi.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
|
||||
var msg_widget = this.widgetContainer.getWidgetById("msg");
|
||||
@ -494,18 +494,35 @@ etemplate2.prototype.refresh = function(msg, id, type)
|
||||
$j(msg_widget.getDOMNode()).parents().show();
|
||||
}
|
||||
|
||||
|
||||
this.widgetContainer.iterateOver(function(_widget) {
|
||||
// TODO: This is not quite right - will restrict to just this one row
|
||||
/*
|
||||
if(_widget.options.settings && _widget.options.settings.row_id)
|
||||
{
|
||||
_widget.activeFilters[_widget.options.settings.row_id] = id;
|
||||
}
|
||||
*/
|
||||
// Trigger refresh
|
||||
_widget.applyFilters();
|
||||
}, this, et2_nextmatch);
|
||||
// Use jsapi data module to update
|
||||
var uid = app + "::" + id;
|
||||
var update = false;
|
||||
switch(type)
|
||||
{
|
||||
case "update":
|
||||
if(!egw(app).dataRefreshUID(uid))
|
||||
{
|
||||
// Could not update just that row
|
||||
this.widgetContainer.iterateOver(function(_widget) {
|
||||
// Trigger refresh
|
||||
_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 //
|
||||
|
Loading…
Reference in New Issue
Block a user