1 Reply Latest reply on Mar 25, 2011 11:36 AM by Shongrunden

    CustomLayout getElementAt issure

    Benoitcn Level 1

      I try put get the width of each element. When I iterate items use target.getElementAt,

      it always return null to me. If I use the layout to the application it works fine.
      And If I enable list's useVirtualLayout property.
      the getVirtualElementAt return null only in the measure function, in updateDisplayList it can get correct return.
      This is my code:
      while(_curIndex < _totalElements - 1)
                     {
                          // this line work fine only in updateDisplayList function on "useVirtualLayout" is disableed. In measure it also get null.
                          // otherwise getElementAt is always return null whatever in updateDisplayList or measure.
                          var element:ILayoutElement = _useVirtual ? _target.getVirtualElementAt(++_curIndex) :_target.getElementAt(++_curIndex);
                          if(element && element.includeInLayout)
                          {
                               return element;
                          }
                     }
                     return null;