Hi Guys
I asked his question earlier too and you guys were helpful in giving
me solution but i ended up implementing solution which consume lot of
resources . 
I have a tree which is getting data from Postgres though HTTP service
and binding data in XMLList. As soon as new entry has been added to
the database I need my Tree to be updated. I set a timer and what that
timer does is it calls that HTTP service (And goes through Postgres)
after some time and load all the entries back to the Tree. Now this
solution works but the solution would be pain if there are 2000
entries in the database and a new entry has been added, then it loops
through all the 2000 entries and put all these entries in the Tree
which takes lots of resources.
In short what i need is that the timer should only go through the
database when new entry has been added in the database and istead of
loading all the entries in the Tree it should only load the added entry. 
Please let me know if it is possible to do and if yes which way should
I go. Should I target changing the Flex code or does it have to be
done through post gres. Your help will be appreciated. Below is code
Thanks
Anuj
/*Code*/
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="initApp();"
        xmlns:nimer="com.mikenimer.components.datagrid.*"
         height="758" y="10" x="260" width="800"
backgroundImage="contentPanelTest.swf"  backgroundColor="#92959E"
         horizontalScrollPolicy="off" verticalScrollPolicy="off">

<mx:HTTPService id="devicesXML" method="GET" resultFormat="e4x"
url="http://10.80.3.56:8182/config/devices";
                result="devicesXMLHandler(event)" showBusyCursor="true">

public function initApp():void
                        {
                                pollHttpService();
                                //Set the Timer
                                
timer.addEventListener(TimerEvent.TIMER,onTimer);
                                timer.start();
                                }
private function onTimer(event:TimerEvent):void
                        {
                                pollHttpService();                              
                        } 
                        //Sets up the URL and invokes Send
                        private function pollHttpService()
                        {
                                var sTime:String=new Date().toTimeString();
                                var sURL:String=_sURLData+"?time="+sTime;
                                trace("url="+sURL);
                                devicesXML.url=sURL; //to avoid caching
                                devicesXML.send();      //call for data 
                        }
                        

<mx:Tree
         dataProvider="{devicesCollection}"
         labelField="@id"
         dropEnabled="false"
         dragEnabled="true"      
         dragMoveEnabled="false"
         labelFunction="treeLabel"
         y="79" x="17" height="541" width="317"/>

Reply via email to