Kevincosme / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

TreeGrid openItemAt with null 2nd parameter doesn't open correctly #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Call openItemAt manually on a tree grid instance, just passing an index
for the first parameter and leaving the (supposeduly optional) second
parameter blank.

What is the expected output? What do you see instead?

The item opens, but the disclosure icon is incorrect and clicking it will
duplicate the list of child items.

The workaround is to make sure to explicitly pass a second parameter... for
example:

// Open all of the top level items - start with the last element
// and work backwards.
for ( var i:int = 0; i < grid.dataProvider.length; i-- )
{
  // Have to pass the item as the second param or else open 
  // has strange results
  grid.openItemAt( i, grid.dataProvider[i] );
}

Please use labels and text to provide additional information.

Original issue reported on code.google.com by darron.schall on 21 Sep 2007 at 6:15

GoogleCodeExporter commented 8 years ago

Original comment by dmcc...@gmail.com on 25 Dec 2007 at 2:24

GoogleCodeExporter commented 8 years ago

Original comment by dmcc...@gmail.com on 26 Dec 2007 at 7:32

GoogleCodeExporter commented 8 years ago
The fix for this is to move the null check as the first statement:

public function openItemAt( rowNum : Number, item : Object = null ) : void
{
  if ( item == null )
    item = ListCollectionView( _displayedModel ).getItemAt( rowNum );

  var uid : String = itemToUID( item );
  openItems[ uid ] = item;

  this.selectedIndex = -1;

Original comment by hughes.m...@gmail.com on 30 Sep 2008 at 7:43