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

@ -285,6 +285,12 @@ Scholar.ItemGroup.prototype.getName = function()
} }
Scholar.ItemGroup.prototype.getChildItems = function() Scholar.ItemGroup.prototype.getChildItems = function()
{
if(this.searchText)
{
return Scholar.Items.get(Scholar.Items.search(this.searchText));
}
else
{ {
if(this.isCollection()) if(this.isCollection())
return Scholar.getItems(this.ref.getID()); return Scholar.getItems(this.ref.getID());
@ -293,3 +299,9 @@ Scholar.ItemGroup.prototype.getChildItems = function()
else else
return null; return null;
} }
}
Scholar.ItemGroup.prototype.setSearch = function(searchText)
{
this.searchText = searchText;
}

View file

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