rem: BubbleSort(column, ascending, table); 
add: var compareFunc; if (ascending) { compareFunc = function compare(first, second) { if (first[column] < second[column]) return 1; if (first[column] > second[column]) return -1; return 0; } } else { compareFunc = function compare(first, second) { if (first[column] < second[column]) return -1; if (first[column] > second[column]) return 1; return 0; } } table.sort(compareFunc); 
context: function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending) {  // 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  BubbleSort(column, ascending, table);  // restore the selection  var selectedRow = -1;  if (selectedNumber>=0) {    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.treeBoxObject.view.selection.select(-1);        tree.treeBoxObject.view.selection.select(s);        selectedRow = s;        break;      }    }  }  // display the results  tree.treeBoxObject.invalidate();  if (selectedRow>0) {    tree.treeBoxObject.ensureRowIsVisible(selectedRow)  }  return ascending;}
meta: 5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5872/91f81e4d5bc181360b61943e3bd6226db9c60859/treeUtils.js/buggy/suite/common/permissions/treeUtils.js