We'll I got it to work using a completionCreateHandler.
Basically where the datagrid is complete, it calls the dataGrid_creationCompleteHandler function which checks the row count for the datagrid.
I also had to change the dataGrid.rowCount to = Array(getFLOWTESTResult.lastResult).length;
, which gives me the following warning... but it still works.
Description Resource Path Location Type
1112: Array(x) behaves the same as new Array(x). To cast a value to type Array use the expression x as Array instead of Array(x). FireFlow2.mxml /FireFlow2/src line 26 Flex Problem
-Will
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.DataGrid;
import mx.core.mx_internal;
import mx.events.EventListenerRequest;
import mx.events.FlexEvent;
import mx.rpc.CallResponder;
import mx.rpc.events.ResultEvent;
private var PRESSID:String = "";
private function init(): void
{
PRESSID = this.parameters.PRESSID;
getFLOWTESTResult.token = fLOWTESTService1.getFLOWTEST(PRESSID);
dataGrid.rowCount=Array(getFLOWTESTResult.lastResult).length;
}
protected function button_clickHandler(event:MouseEvent):void
{
//if (fLOWTESTService1 != null) {
//Alert.show("No flow test data for this fire hydrant.");
//}else {
if (dataGrid.rowCount>1) {
getFLOWTESTResult.token = fLOWTESTService1.getFLOWTEST(pRESSIDTextInput.text);
Alert.show (dataGrid.rowCount + " is the count .... there is data.");
}else {
Alert.show("No Data");
}
}
private function dateFormat(item:Object, column:DataGridColumn):String{
return dateFormatter.format(item [column.dataField]);
}
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
if (dataGrid.rowCount<=1) {
Alert.show("No Data ....... and the row count is... " + dataGrid.rowCount);
}else {
Alert.show ("There is some data " + dataGrid.rowCount + " is the counTTTTTTTT");
}
}
]]>
</fx:Script>