4 Replies Latest reply on Mar 24, 2009 12:03 PM by Newsgroup_User

    Problems with DataGrid

    tech_holic
      I'm in trouble here with DataGrid, i have an implementation where a public bindable property of a custom component is used binded as the dataProvider for a Datagrid inside this component, but, when i change this property and then tell my ViewStack to jump over to that component, the DataGrid sometimes doesn't get refreshed with the right data. I tested if the dataProvider is right and it is, and when i just push (meaning .push(item:*)) an item in the list, the DataGrid shows correctly. problem is, i must show data without having to push an item, so i work-arounded it with a timer implementation that pushes and deletes an empty value, what's by the way terrible.
      I went to JIRA trying to see what's been made on this, but all related bugs are told to be historical and shows no information at all.
      Am i doing something wrong? or it's a bug no one talks about?
        • 1. Re: Problems with DataGrid
          Gregory Lafrance Level 6
          What is your dataProvider? If it is a collection (and that would be preferrable), then maybe call the refresh() method on the collection?
          • 2. Re: Problems with DataGrid
            tech_holic Level 1
            This doesn't solve my problem, my list is an ArrayCollection and it doesn't work even if i call it from the timer.
            The real problem is: the list is ok, it's populated right, but tha datagrid doesn't refresh till i add or remove an item from the list, what could possibly be causing this error?
            • 3. Re: Problems with DataGrid
              John Hall Level 4
              Have you tried a datagrid.validateNow() after the refresh to see if that does anything?
              • 4. Re: Problems with DataGrid
                Level 7

                "tech_holic" <webforumsuser@macromedia.com> wrote in message
                news:gq8lok$jdh$1@forums.macromedia.com...
                > I'm in trouble here with DataGrid, i have an implementation where a public
                > bindable property of a custom component is used binded as the dataProvider
                > for
                > a Datagrid inside this component, but, when i change this property and
                > then
                > tell my ViewStack to jump over to that component, the DataGrid sometimes
                > doesn't get refreshed with the right data. I tested if the dataProvider is
                > right and it is, and when i just push (meaning .push(item:*)) an item in
                > the
                > list, the DataGrid shows correctly. problem is, i must show data without
                > having
                > to push an item, so i work-arounded it with a timer implementation that
                > pushes
                > and deletes an empty value, what's by the way terrible.
                > I went to JIRA trying to see what's been made on this, but all related
                > bugs
                > are told to be historical and shows no information at all.
                > Am i doing something wrong? or it's a bug no one talks about?

                If you use .push into the internal Array of an ArrayCollection, then it's
                not going to generate any of the events that ArrayCollection uses if you use
                its official API (addItem/removeItem).

                I suspect that what you're doing is replacing the ArrayCollection when you
                populate it rather than just adding or removing.

                HTH;

                Amy