Ah, it might be a caching issue.  "GET" is subject to that.  Can you use
"POST"?  Otherwise, append a random string, like new Date().toString to
the HTTPService url.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Tuesday, October 21, 2008 8:13 PM
To: [email protected]
Subject: RE: [flexcoders] How to keep Tree control synchronized with the
database. Please Help

 

That should update the tree automatically.  Have you debugged to be sure
"devicesXMLHandler" is getting called when you expect?

 

It should not be necessary, but try directly re-assigning the tree
dataProvider in the result handler.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of anuj181
Sent: Tuesday, October 21, 2008 7:23 PM
To: [email protected]
Subject: [flexcoders] How to keep Tree control synchronized with the
database. Please Help

 

Hi Guys
I am trying to retrieve values form the database PostGres. I used REST
calls for fetching the data and i am successful in binding that data
with the data Provider of Tree control.
Now my problem is that if I inserted any entry in the database, it
will not update the Tree control directly. Once i refresh the page it
shows the inserted entry. Can some one explain what 's the best way of
dynamically synchronizing my Tree Control (UI) with the database.
Any help and guidance or approach will be highly appreciated.
Thanks
Anuj
/*Here's the small piece of code*/
<mx:HTTPService id="devicesXML" method="GET" resultFormat="e4x"
url="http://10.80.3.56:8182/config/devices
<http://10.80.3.56:8182/config/devices> "
result="devicesXMLHandler(event)" showBusyCursor="true">
<mx:request>
<url>http://10.1.3.36:8182/config/devices
<http://10.1.3.36:8182/config/devices> </url>
</mx:request>
</mx:HTTPService>

private var devicesList:XMLList;

[Bindable]
private var devicesCollection:XMLListCollection; 

private function devicesXMLHandler(event:ResultEvent):void

{
devicesList = event.result.device;
devicesCollection = new XMLListCollection(devicesList);


}
<mx:Tree width="100%" height="100%"
dataProvider="{devicesCollection}"
labelField="@id"
dropEnabled="false"
dragEnabled="true"
dragComplete="onTreeDragComplete(event)"
dragMoveEnabled="false"
labelFunction="treeLabel" 
change="populateForm(event)"
/>

 

Reply via email to