I was able to solve my problem with following async loop, but I wonder if there
is some
simpler solution.
private var itemArray:ArrayCollection
private var index:int;
private var count:int;
private var noIPE:Boolean;
public function execute(cgEvent:CairngormEvent):void
{
count = itemArray.length;
index = 0;
noIPE = true;
start();
}
private function start():void
{
try
{
trace("start: " + index);
while((noIPE == true) && (index < count))
{
processItem(null, itemArray.getItemAt(index) as
ItemDTO);
}
}
catch(ipe:ItemPendingError)
{
noIPE = false;
trace("item pending error: " + index);
ipe.addResponder(new ItemResponder(processItem, fetchError));
}
}
private function fetchError(message:ErrorMessage):void
{
trace("error fetching item: " + message.faultString);
}
private function processItem(data:Object, item:ItemDTO = null):void
{
trace("processItem: " + index);
if(item == null)
item = itemArray.getItemAt(index) as ItemDTO;
.....
index++;
if(index < count)
{
if(noIPE == false)
{
noIPE = true;
start();
}
}
else
{
finish();
}
}
--- In [email protected], Zdenek Mikan <[EMAIL PROTECTED]> wrote:
>
> I have an ArrayCollection which is filled from the LCDS/Hibernate
> destination with lazy=true. For display it is OK, but for export I need
> to go through all items to send them to output. Is there any way how to
> force fetch all items from the server?
>
> BTW the sample in LCDS ES 2.6 Developer Guide on page 242-243 is wrong -
> you will get the ipe exception on line with ipe.addResponder in catch
> clause.
>
> Zdenek M
>