From: Dan Wells Date: Mon, 26 Mar 2012 20:07:58 +0000 (-0400) Subject: Serial Control: Refresh node map on edit X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2a257b27b2a2553023c07fddf5aa3abf95a19f66;p=evergreen%2Fpines.git Serial Control: Refresh node map on edit While it would be nice to redraw any affected tree nodes when editing, we should at least replace the map data in case it is used in other functions. Signed-off-by: Dan Wells --- diff --git a/Open-ILS/xul/staff_client/server/serial/manage_subs.js b/Open-ILS/xul/staff_client/server/serial/manage_subs.js index 74ca397796..9b1a85bdb7 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_subs.js +++ b/Open-ILS/xul/staff_client/server/serial/manage_subs.js @@ -53,16 +53,40 @@ serial.manage_subs.prototype = { params.do_edit = true; params.handle_update = true; + params.trigger_refresh = true; if (mode == 'add') { - params.trigger_refresh = true; params.refresh_command = function () {obj.refresh_list();}; + } else { + params.refresh_command = function () {obj.remap_node(type, this);}; } + obj[editor_type].init(params); } catch(E) { obj.error.standard_unexpected_error_alert('editor_init() error',E); } }, + // while not a true tree node repace, this should at least prevent + // non-display side-effects. True node replace is TODO + 'remap_node' : function(type, editor_obj) { + var obj = this; + try { + for (i = 0; i < editor_obj[editor_obj.fm_type_plural].length; i++) { + var new_obj = editor_obj[editor_obj.fm_type_plural][i]; + var old_obj = obj['map_' + type][type + '_' + new_obj.id()]; + if (type == 'ssub') { // add children back on + new_obj.distributions(old_obj.distributions()); + new_obj.issuances(old_obj.issuances()); + new_obj.scaps(old_obj.scaps()); + } + obj['map_' + type][type + '_' + new_obj.id()] = new_obj; + } + editor_obj.render(); + } catch(E) { + obj.error.standard_unexpected_error_alert('remap_node() error',E); + } + }, + 'do_delete' : function(type, method, overridable_events) { var obj = this; try {