2 Replies Latest reply on Jan 18, 2007 3:16 PM by huper2k-mXsgUx

    Datagrid / timer based polling for live data

    huper2k-mXsgUx
      Hello,

      Thanks for opening my question.

      I have a datagrid that is bound to an Array (not ArrayCollection) that comes from an AMFPHP query.
      There is a setinterval timer that updates the array with new data every 5 seconds.

      Trouble is, when you select a row in the dataset, when the setInterval timer fires, it loses focus of the selected item. Is there a way around it? I know FDS has support for subscribing to updates, but we are a very small startup and we cannot afford FDS right now.

      Can I be helped? Feel free to post solutions that involve opensource software that will run on LAMP.

      Thanks for reading.
      -Chris
        • 1. Re: Datagrid / timer based polling for live data
          ntsiii Level 3
          If you can devise logic that lets you update the individual dataprovider elements instead of re-assigning the entire dataProvider, that should do what you want.

          I haven't tested this, mind you but, my experience indicates it should work.

          You would want to compare the new data with the current data, and to use the appropriate api to update the changed item. It would probably be setItemAt() for Array collection, for example. Try this before you re-architect your app, though.

          Alternatively, you could just restore the focus after an update.

          Tracy
          • 2. Re: Datagrid / timer based polling for live data
            huper2k-mXsgUx Level 1
            Thanks for the help,
            I took your advise and went the simpler route of reseting the selected item.
            To your point, I'm working on a more elaborate solution that updates the array.

            Thank you very much,
            -Chris