Scholar.ItemTreeView = function(itemGroup) { this._treebox = null; this._dataItems = new Array(); this.rowCount = 0; this._itemGroup = itemGroup; this.refresh(); this._unregisterID = Scholar.Notifier.registerItemTree(this); } 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++) this._showItem(newRows[i], i+1); //item ref, before row this._refreshHashMap(); } Scholar.ItemTreeView.prototype.unregister = function() { Scholar.Notifier.unregisterItemTree(this._unregisterID); } Scholar.ItemTreeView.prototype.setTree = function(treebox) { if(this._treebox) return; this._treebox = treebox; this.sort(); } Scholar.ItemTreeView.prototype.getCellText = function(row, column) { var obj = this._getItemAtRow(row); var val = obj.getField(column.id); if(column.id == 'dateAdded' || column.id == 'dateModified') //this is not so much that we will use this format for date, but a simple template for later revisions. { var myDate = new Date(); myDate.setTime(Date.parse(val.replace("-","/").replace("-","/"))); val = Scholar.Date.formatDate(myDate,'M/d/y h:mma'); } return val; } Scholar.ItemTreeView.prototype._showItem = function(item, beforeRow) { this._dataItems.splice(beforeRow, 0, item); this.rowCount++; } Scholar.ItemTreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; } Scholar.ItemTreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row]; } Scholar.ItemTreeView.prototype.isSorted = function() { for(var i=0, len=this._treebox.columns.count; 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(); this.selection.clearSelection(); for(var i=0; i < selectedIDs.length; i++) { this.selection.toggleSelect(this._itemRowMap[selectedIDs[i]]); } this.selection.selectEventsSuppressed = false; this._treebox.invalidate(); } 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 0) { rows.sort(function(a,b) { return a-b }); for(var i=0, len=rows.length; i