Simple, yet inefficient, searching from upper right-hand corner.

This commit is contained in:
David Norton 2006-06-06 20:33:49 +00:00
parent c807d335e9
commit 2513c829a6
2 changed files with 24 additions and 8 deletions

View file

@ -286,10 +286,22 @@ Scholar.ItemGroup.prototype.getName = function()
Scholar.ItemGroup.prototype.getChildItems = function()
{
if(this.isCollection())
return Scholar.getItems(this.ref.getID());
else if(this.isLibrary())
return Scholar.getItems();
if(this.searchText)
{
return Scholar.Items.get(Scholar.Items.search(this.searchText));
}
else
return null;
{
if(this.isCollection())
return Scholar.getItems(this.ref.getID());
else if(this.isLibrary())
return Scholar.getItems();
else
return null;
}
}
Scholar.ItemGroup.prototype.setSearch = function(searchText)
{
this.searchText = searchText;
}

View file

@ -16,7 +16,8 @@ Scholar.ItemTreeView.prototype.refresh = function()
var newRows = this._itemGroup.getChildItems();
for(var i = 0; i < newRows.length; i++)
this._showItem(newRows[i], i+1); //item ref, before row
if(newRows[i])
this._showItem(newRows[i], i+1); //item ref, before row
this._refreshHashMap();
}
@ -168,8 +169,11 @@ Scholar.ItemTreeView.prototype.deleteSelection = function()
Scholar.ItemTreeView.prototype.searchText = function(search)
{
//does nothing, right now.
// this._refreshHashMap();
this._itemGroup.setSearch(search);
var oldCount = this.rowCount;
this.refresh();
this._treebox.rowCountChanged(0,this.rowCount-oldCount);
this._treebox.invalidate();
}
Scholar.ItemTreeView.prototype._refreshHashMap = function()