XULTreeViewRecord.calculateVisualRow Member

calculate the "visual" row for this record. If the record isn't actually visible return -1. eg. Name Visual Row node1 0

Syntax

object.calculateVisualRow();

Returns

Remarks

 node11    1
  node12    2
node2       3
  node21    4
node3       5

See Also

Source Code

function xtvr_calcrow ()
{
/* if this is the second time in a row that someone asked us, fetch the last
* result from the cache. */
if (this._share.lastIndexOwner == this)
return this._share.lastComputedIndex;
var vrow;
/* if this is an uninserted or hidden node, or... */
if (!("parentRecord" in this) || (this.isHidden) ||
/* if parent isn't open, or... */
(!this.parentRecord.isContainerOpen) ||
/* parent isn't visible */
((vrow = this.parentRecord.calculateVisualRow()) == -1))
{
/* then we're not visible, return -1 */
//dd ("cvr: returning -1");
return -1;
}
/* parent is the root node XXX parent is not visible */
if (vrow == null)
vrow = 0;
else
/* parent is not the root node, add one for the space they take up. */
++vrow;
/* add in the footprint for all of the earlier siblings */
var ci = this.childIndex;
for (var i = 0; i < ci; ++i)
{
if (!this.parentRecord.childData[i].isHidden)
vrow += this.parentRecord.childData[i].visualFootprint;
}
/* save this calculation to the cache. */
this._share.lastIndexOwner = this;
this._share.lastComputedIndex = vrow;
return vrow;
}