Implement refresh type 'update' to _only_ update the data of a row - sorting is not considered, so make sure to use 'edit' if sorting might be affected.

This commit is contained in:
Nathan Gray 2014-01-13 09:40:23 +00:00
parent 4273257138
commit 71f0fcdda0
4 changed files with 21 additions and 10 deletions

View File

@ -411,14 +411,17 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
* Refresh given rows for specified change * Refresh given rows for specified change
* *
* Change type parameters allows for quicker refresh then complete server side reload: * Change type parameters allows for quicker refresh then complete server side reload:
* - edit: request just modified data from given rows * - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary) * - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload * - add: requires full reload
* *
* @param array|string _row_ids rows to refresh * @param {string[]|string} _row_ids rows to refresh
* @param string _type "edit" (default), "delete" or "add" * @param {?string} _type "update", "edit", "delete" or "add"
* *
* @fires refresh * @see jsapi.egw_refresh()
* @fires refresh from the widget itself
*/ */
refresh: function(_row_ids, _type) { refresh: function(_row_ids, _type) {
if (typeof _type == 'undefined') _type = 'edit'; if (typeof _type == 'undefined') _type = 'edit';
@ -444,9 +447,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
var uid = app + "::" + _row_ids[i]; var uid = app + "::" + _row_ids[i];
switch(_type) switch(_type)
{ {
/*
case "update": case "update":
case "edit":
if(!egw().dataRefreshUID(uid)) if(!egw().dataRefreshUID(uid))
{ {
// Could not update just that row // Could not update just that row
@ -454,7 +455,6 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
break id_loop; break id_loop;
} }
break; break;
*/
case "delete": case "delete":
// Blank the row // Blank the row
egw().dataStoreUID(uid,null); egw().dataStoreUID(uid,null);

View File

@ -638,7 +638,7 @@ etemplate2.prototype.getValues = function(_root)
* *
* @param msg String Message to try to display. eg: "Entry added" (not used anymore, handeled by egw_refresh and egw_message) * @param msg String Message to try to display. eg: "Entry added" (not used anymore, handeled by egw_refresh and egw_message)
* @param id String|null Application specific entry ID to try to refresh * @param id String|null Application specific entry ID to try to refresh
* @param type String|null Type of change. One of 'edit', 'delete', 'add' or null * @param type String|null Type of change. One of 'update','edit', 'delete', 'add' or null
* *
* @see jsapi.egw_refresh() * @see jsapi.egw_refresh()
* @see egw_fw.egw_refresh() * @see egw_fw.egw_refresh()

View File

@ -238,7 +238,13 @@ abstract class egw_framework
* @param string $msg message (already translated) to show, eg. 'Entry deleted' * @param string $msg message (already translated) to show, eg. 'Entry deleted'
* @param string $app application name * @param string $app application name
* @param string|int $id=null id of entry to refresh * @param string|int $id=null id of entry to refresh
* @param string $type=null either 'edit', 'delete', 'add' or null * @param string $type=null either 'update', 'edit', 'delete', 'add' or null
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload for proper sorting
* - null: full reload
* @param string $targetapp=null which app's window should be refreshed, default current * @param string $targetapp=null which app's window should be refreshed, default current
* @param string|RegExp $replace=null regular expression to replace in url * @param string|RegExp $replace=null regular expression to replace in url
* @param string $with=null * @param string $with=null

View File

@ -214,7 +214,12 @@ function egw_getAppName()
* @param string _msg message (already translated) to show, eg. 'Entry deleted' * @param string _msg message (already translated) to show, eg. 'Entry deleted'
* @param string _app application name * @param string _app application name
* @param string|int _id=null id of entry to refresh * @param string|int _id=null id of entry to refresh
* @param string _type=null either 'edit', 'delete', 'add' or null * @param string _type=null either 'update', 'edit', 'delete', 'add' or null
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload for proper sorting
* @param string _targetapp which app's window should be refreshed, default current * @param string _targetapp which app's window should be refreshed, default current
* @param string|RegExp _replace regular expression to replace in url * @param string|RegExp _replace regular expression to replace in url
* @param string _with * @param string _with