PDA

View Full Version : datagrid event problem


Anitha
04-09-2008, 08:16 AM
Hi all,
Here my doubt is I have two datagrids and two tables.
My 1st grid contains three columns year, sales , profit.
My 2nd grid have four fields year, region ,sales, profit.
In my first datagrid i have loaded data from a table using the webservice successfully.
when i select a row in the 1st grid it need to send the selected row's year value to the operation of the webservice.The wbservice results are need to load in my 2nd datagrid.
How can i achieve this.Hereby i tried in some way.But i am not met the result.Any idea please?

My script is:
<mx:WebService id="ss" wsdl="http://localhost/Service.asmx?wsdl"
showBusyCursor="true">
first operation:
<mx:operation name="getSelectionPeriod" resultFormat="object"
result="remotingHandler(event)"
fault="mx.controls.Alert.show(event.fault.faultString);" >
<mx:request xmlns="">
<Fromyear>{fy.selectedDate.getFullYear()}</Fromyear>
<Toyear>{ty.selectedDate.getFullYear()}</Toyear>
</mx:request>
</mx:operation>

second operation:
<mx:operation name="getDivision" resultFormat="object"
result="resultHandler(event)"
fault="mx.controls.Alert.show(event.fault.faultString);">
<mx:request xmlns="">
<year>{grid.selectedItem}</year> //i think here my dataloading source is wrong??.which is the correct one?
</mx:request>
</mx:operation>
</mx:WebService>

mxml source:
<mx:DataGrid dataProvider="{answer}" id="grid" change="ss.getDivision.send()">
-------
</mx:DataGrid>
<mx:DataGrid dataProvider="{secondanswer}">
------
</mx:DataGrid>

//first operation result handling event
private function remotingHandler(event:ResultEvent):void
{
answer=(event.result.Tables["annualresult"].Rows);
var ans:Array=ArrayUtil.toArray(answer);
}


//second operation result handling event
private function resultHandler(event:ResultEvent):void
{
secondanswer=(event.result.Tables["divisonshow"].Rows);
var sec:Array=ArrayUtil.toArray(secondanswer);
}



By,
Anitha