Bug 543323 - Task list does not show incomplete tasks when you toggle "Show completed Tasks". r=philipp, a=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Sun, 25 Sep 2011 21:16:19 -0400
changeset 8861 d4c1eff7a5e10bbedb4ca880f22c98919baab83d
parent 8860 82bbc61f708ba74cdef72ff1ec961e4fd22a63b0
child 8862 b8bad8be49ca280f7e09f483ef4214628519752e
push idunknown
push userunknown
push dateunknown
reviewersphilipp, philipp
bugs543323
Bug 543323 - Task list does not show incomplete tasks when you toggle "Show completed Tasks". r=philipp, a=philipp
calendar/base/content/calendar-task-tree.xml
--- a/calendar/base/content/calendar-task-tree.xml
+++ b/calendar/base/content/calendar-task-tree.xml
@@ -1067,29 +1067,33 @@
       <method name="onOperationComplete">
         <body><![CDATA[
           // signal that the current operation finished.
           this.mPendingRefresh = null;
 
           // immediately start the next job on the queue.
           this.popRefreshQueue();
 
-          var tree = document.getAnonymousNodes(this)[0];
-          if(this.mTreeView.selectedColumn) {
+          if (this.mTreeView.selectedColumn) {
               this.sortItems();
           } else {
               this.recreateHashTable();
           }
 
-          var tree = document.getAnonymousElementByAttribute(
+          let tree = document.getAnonymousElementByAttribute(
               this, "anonid", "calendar-task-tree");
           tree.view = this.mTreeView;
 
+          // make sure the tree's current index is still valid
+          if (tree.currentIndex >= this.mTaskArray.length) {
+              tree.currentIndex = (this.mTaskArray.length - 1);
+          }
+
           // we also need to notify potential listeners.
-          var event = document.createEvent('Events');
+          let event = document.createEvent('Events');
           event.initEvent('select', true, false);
           this.dispatchEvent(event);
         ]]></body>
       </method>
 
       <method name="sortItems">
         <body><![CDATA[
           if (this.mTreeView.selectedColumn) {