From 51d7c146fbd447a25a050d5e1c32b9fb793defac Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 6 Dec 2011 19:28:44 +0000 Subject: [PATCH] See ChangeLog. Monotone-Parent: 9c4be3d7d32f456638c073296f3c3b84ca2f6ea9 Monotone-Revision: 0e0730fe59a4d574138454dc943c443900fe67b6 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-12-06T19:28:44 --- ChangeLog | 5 +++++ UI/WebServerResources/ContactsUI.js | 6 +++--- UI/WebServerResources/HTMLElement.js | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03a7b49cc..3efe0f5d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-06 Francis Lachapelle + + * UI/WebServerResources/ContactsUI.js (contactsListCallback): + Force deselection of all rows when changing addressbook. + 2011-12-06 Wolfgang Sourdeau * SoObjects/Appointments/iCalEvent+SOGo.m (-firstOccurrenceRange): diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index c11b306a8..bd3e5f673 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -190,8 +190,7 @@ function contactsListCallback(http) { // Restore selection and scroll to first selected node var selection = http.callbackData; - if (selection) { - tbody.refreshSelectionByIds(selection); + if (selection && tbody.refreshSelectionByIds(selection) > 0) { for (var i = 0; i < selection.length; i++) { var row = $(selection[i]); if (row) { @@ -202,7 +201,8 @@ function contactsListCallback(http) { } } } - + else + tbody.deselectAll(); } else { // No more access to this address book; empty the list diff --git a/UI/WebServerResources/HTMLElement.js b/UI/WebServerResources/HTMLElement.js index b76d73549..7e96f4084 100644 --- a/UI/WebServerResources/HTMLElement.js +++ b/UI/WebServerResources/HTMLElement.js @@ -257,12 +257,14 @@ Element.addMethods({ var s = element.select("._selected"); for (var i = 0; i < s.length; i++) s[i].removeClassName("_selected"); + element.selectedElements = null; element.selectedIds = null; }, refreshSelectionByIds: function(element, selectedIds) { element = $(element); + var selectedCount = 0; if (selectedIds) element.selectedIds = selectedIds; if (element.selectedIds) { @@ -272,6 +274,7 @@ Element.addMethods({ if (e) { if (!e.hasClassName('_selected')) e.addClassName('_selected'); + selectedCount++; } else { log ("refreshSelectionByIds Error: " + element.tagName @@ -280,6 +283,7 @@ Element.addMethods({ } } } + return selectedCount; }, setCaretTo: function(element, pos) {