From 4ab0aaab9f2cf12bd87f3fad4e255a4fc892357d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 18 Feb 2013 09:47:39 +0000 Subject: [PATCH] function signature for new nextmatch refresh method, already working clientside by calling applyFilters, but should be smarter, serverside will require row-data plugin on clientside --- .../class.etemplate_widget_nextmatch.inc.php | 16 ++++++++++++++++ etemplate/js/et2_extension_nextmatch.js | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 70ae22dfe2..0e8876ce5e 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -800,6 +800,22 @@ class etemplate_widget_nextmatch extends etemplate_widget if(is_array(self::$request->preserve[$cname])) unset(self::$request->preserve[$cname][$key]); } } + + /** + * Refresh given rows for specified change + * + * Change type parameters allows for quicker refresh then complete server side reload: + * - edit: send just modified data from given rows + * - delete: just send null for given rows to clientside (no backend call neccessary) + * - add: requires full reload + * + * @param array|string $row_ids rows to refresh + * @param string $type='edit' "edit" (default), "delete" or "add" + */ + public function refresh($row_ids, $type='edit') + { + throw new Exception('Not yet implemented'); + } } // Registration needs to go here, otherwise customfields won't be loaded until some other cf shows up diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 26559e0cfd..ca900a0314 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -254,6 +254,25 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], { // Trigger an update this.controller.update(); }, + + /** + * Refresh given rows for specified change + * + * Change type parameters allows for quicker refresh then complete server side reload: + * - edit: request just modified data from given rows + * - delete: just delete the given rows clientside (no server interaction neccessary) + * - add: requires full reload + * + * @param array|string _row_ids rows to refresh + * @param string _type "edit" (default), "delete" or "add" + */ + refresh: function(_row_ids, _type) { + if (typeof _type == 'undefined') _type = 'edit'; + if (typeof _row_ids == 'string') _rowids = [_row_ids]; + // ToDo: use given context, to be more smart about what to change + this.applyFilters(); + } + /** * Generates the column caption for the given column widget