Scholar.ItemTreeView = function(itemGroup) { this._itemGroup = itemGroup; this._treebox = null; this._savedSelection = null; this.refresh(); this._unregisterID = Scholar.Notifier.registerItemTree(this); } Scholar.ItemTreeView.prototype.setTree = function(treebox) { if(this._treebox) return; this._treebox = treebox; this.sort(); } Scholar.ItemTreeView.prototype.refresh = function() { this._dataItems = new Array(); this.rowCount = 0; var newRows = this._itemGroup.getChildItems(); for(var i = 0; i < newRows.length; i++) if(newRows[i]) this._showItem(newRows[i], i+1); //item ref, before row this._refreshHashMap(); } Scholar.ItemTreeView.prototype.notify = function(action, type, ids) { var madeChanges = false; this.selection.selectEventsSuppressed = true; this.saveSelection(); if((action == 'remove' && !this._itemGroup.isLibrary()) || (action == 'delete' && this._itemGroup.isLibrary())) { ids = Scholar.flattenArguments(ids); //Since a remove involves shifting of rows, we have to do it in order //sort the ids by row var rows = new Array(); for(var i=0, len=ids.length; i 0) { rows.sort(function(a,b) { return a-b }); for(var i=0, len=rows.length; i b.getField(column.id)) ? 1 : 0; } } else { function columnSort(a,b) { return(a.getField(column.id) > b.getField(column.id)) ? -1 : (a.getField[column.id] < b.getField(column.id)) ? 1 : 0; } } this._dataItems.sort(columnSort); this._refreshHashMap(); } Scholar.ItemTreeView.prototype.deleteSelection = function() { if(this.selection.count == 0) return; //create an array of selected items var items = new Array(); var start = new Object(); var end = new Object(); for (var i=0, len=this.selection.getRangeCount(); i