0 Replies Latest reply on Jun 3, 2009 1:08 PM by tntomek

    ADG/DataGrid prevent render even from firing immediately on property

    tntomek

      Hi,

      Is there any way to tell the ADG to not re-render itself immediately after a
      propertyChanged even has been fired in the dataProvider?

      I have quite a wide row (lots of cells) and lots of custom logic that updates
      these dependent properties on each row. i.e. calculated columns. I am doing the
      calculations at dataProvider level vs labelFunctions. On each "set" function of
      one of my cells in the row I raise a "propertyChanged" event if the value was
      changed. Tracing through what the ADG is doing I'm finding that its re-rendering
      each time I raise this event even if its in the same row. Is there any way to
      tell the ADG to wait a few milliseconds in case another propertyChanged event
      comes in so as to render once instead of 10 times?

      If there is no ADG option what is the best pattern for this assuming I want to
      do this in my underlying dataprovider objects. Should I raise custom events and
      fake a itemUpdated once I know there are no more changes? I don't see a clean
      way to do this however since I never really know when I'm done, and using a
      timer or something of this nature seems like a major hack.

      -Tom

       

      ------------------------------------------------------------------------------------------ -----

      Rest of discussion from FlexCoders ...

       

       

       

      Re: ADG/DataGrid prevent render even from firing immediately on propertyChange


      You might try enableAutoUpdate and disableAutoUpdate on ICollectionView, not
      sure if that has the desired affect or not.

      You could also put custom events in your model objects and manually dispatch
      collection events or call explicitly tell the grid when to update.

       

      ------------------------------------------------------------------------------------------ -----

       

      By "explicitly tell the grid when to update" do you mean manually calling
      itemUpdated at the View level?. If so does the grid actually "know" to re-render
      only that updated row? It seems to me that it always re-rendered all visible
      cells regardless of what was changed. So passing null or a real row into
      itemUpdated has the same results.

      Also if I am to manully dispatch propertyChanged from my row, and I never really
      know when I'm done updating all of my dependant cells is there any good way to
      do this. i.e. Cell A update cell B and cell B update updates cell E, and this
      can go on indefinatley. By catchign all property changed events at Row level and
      using a timer of say 50ms i would almost guarantee that I wouldn't rethrow more
      than a single propertyChanged event on any of the updated cells in a row. Do you
      think there is a better way to do this?

       

      ------------------------------------------------------------------------------------------ -----

       

      Follow up finding,

      Do 10 propertyChanged events from my dataProvider cause grid to refresh once or
      10 times? My most recent observations show that it's just once, though for some
      reason the first load invokes my labelFunction 3 times. Is there any point in
      using enableAutoUpdate if grid appears to be 'smart' enough?