I'm having some issues getting an event to fire programmatically. I have two datagrids. I execute an identifyTask from a click on the map and populate myGrid with the results. When I click on a record in myGrid, the dataGridClickEvent function is run which populates detailGrid with more detailed information. This all runs fine, but I would like it so that if there is only one result from the identifyTask, the dataGridClickEvent function runs automatically to populate detailGrid.
This is the code I am using, but detailGrid is still not being populated unless I physically click on the record in myGrid.
//ArrayCollection for my results
initDG = new ArrayCollection(DGArray);
//if the ArrayCollect has only one result
if (initDG.length == 1)
{
myGrid.dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, false,0,0));
}
I have also tried:
dataGridClickEvent(new ListEvent(ListEvent.ITEM_CLICK, false, false ,0,0));
Can anyone tell me where I am going wrong?
Thanks.