Highlighted

datagrid refresh after pop up window closed

czou

01-06-2008

Hi,



I am pretty new to Flex. I have a simple question which I
think someone can certainly help.



So basically my main page contains a datagrid that maps to a
XMLListCollection that tied to a php backend (this php script
queries a db table). From the main page, I can invoke a pop up
window which displays a form. Once the form is submitted(the same
table is updated correctly), how can I refresh the datagrid?



Any help would be greatly appreciated!



Here is the code sample:



----in the main page

<mx:HTTPService id="ds" url="
http://127.0.0.1:81/test.php"
method="GET" resultFormat="e4x"/>

<mx:XMLListCollection id="xmlList"
source="{ds.lastResult.People}" />



<mx:DataGrid id="peoplelist" initialize="ds.send()"
dataProvider="{xmlList}">

<mx:columns>

<mx:DataGridColumn dataField="ID" />

<mx:DataGridColumn dataField="Name" />

</mx:columns>

</mx:DataGrid>

-- action script to handle submit action

public function submit():void

{

srv.send(); //this send HTTP POST request which is executed
successfully

PopUpManager.removePopUp(_window);



ds.send();

xmlList.refresh();

}

Replies

Highlighted

atta707

02-06-2008

try moving these two statements



ds.send();

xmlList.refresh();



to the result event of the underlying HTTPService that's
being used at srv.send();
Highlighted

czou

02-06-2008

why this is not working inside submit function? Conceptually,
putting them inside the HTTPService event result function is the
same as this one, you still havce to call these two lines.



thanks!