rem: var selectedNumber = selections.length ? table[selections[0]].number : -1; 
add: var selectedNumber = selections.length ? table[selections[0]].id : -1; 
context: function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending, updateSelection) {  // remember which item was selected so we can restore it after the sort  var selections = GetTreeSelections(tree);  var selectedNumber = selections.length ? table[selections[0]].number : -1;  // determine if sort is to be ascending or descending  var ascending = (column == lastSortColumn) ? !lastSortAscending : true;  // do the sort or re-sort  // this is a temporary hack for 1.7, we should implement  // display and sort variables here for trees in general  var compareFunc;  if (column == "expires") {    compareFunc = function compare(first, second) {      if (first.expiresSortValue > second.expiresSortValue)        return 1;      else if (first.expiresSortValue < second.expiresSortValue)        return -1;      else        return 0;    }  } else {    compareFunc = function compare(first, second) {      return first[column].toLowerCase().localeCompare(second[column].toLowerCase());    }  }  table.sort(compareFunc);  if (!ascending)    table.reverse();  // restore the selection  var selectedRow = -1;  if (selectedNumber>=0 && updateSelection) {    for (var s=0; s<table.length; s++) {      if (table[s].number == selectedNumber) {        // update selection        // note: we need to deselect before reselecting in order to trigger ...Selected()        tree.view.selection.select(-1);        tree.view.selection.select(s);        selectedRow = s;        break;      }    }  }  // display the results  tree.treeBoxObject.invalidate();  if (selectedRow >= 0) {    tree.treeBoxObject.ensureRowIsVisible(selectedRow)  }  return ascending;}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/d31df1a4c164f0d9b15383a3387cc1edfb20650b/treeUtils.js/buggy/xpfe/components/permissions/content/treeUtils.js