XULTreeViewRecord.locateChildByVisualRow Member

locates the child record for the visible row targetRow. DO NOT call this with a targetRow less than this record's visual row, or greater than this record's visual row + the number of visible children it has.

Syntax

object.locateChildByVisualRow(targetRow, myRow);

Arguments

ArgumentSummary
targetRow
myRow

Returns

Remarks

See Also

Source Code

function xtvr_find (targetRow, myRow)
{
if (targetRow in this._share.rowCache)
return this._share.rowCache[targetRow];
/* if this is true, we *are* the index */
if (targetRow == myRow)
return (this._share.rowCache[targetRow] = this);
/* otherwise, we've got to search the kids */
var childStart = myRow; /* childStart represents the starting visual row
* for the child we're examining. */
for (var i = 0; i < this.childData.length; ++i)
{
var child = this.childData[i];
/* ignore hidden children */
if (child.isHidden)
continue;
/* if this kid is the targetRow, we're done */
if (childStart == targetRow)
return (this._share.rowCache[targetRow] = child);
/* if this kid contains the index, ask *it* to find the record */
else if (targetRow <= childStart + child.visualFootprint) {
/* this *has* to succeed */
var rv = child.locateChildByVisualRow(targetRow, childStart + 1);
//XXXASSERT (rv, "Can't find a row that *has* to be there.");
/* don't cache this, the previous call to locateChildByVisualRow
* just did. */
return rv;
}
/* otherwise, get ready to ask the next kid */
childStart += child.visualFootprint;
}
return null;
}