0 Replies Latest reply on Jun 30, 2009 9:35 AM by NewishFlexCoder436

    Refresh Datagrid After Popup Data Edit

    NewishFlexCoder436

      Hi all,

       

      I'm fairly new to flex development, so please keep that in mind when trying to help... I may ask some really stupid questions!

       

      Basically what I'm trying to do is to refresh the source data of a datagrid ONLY when the popup window that I'm using to add/edit/delete records is closed.

       

       

      I have successfully captured WHEN the window closes... I can see the event happening in my datagrid component.  I used an Alert.show() to prompt me after the popup closes and the datagrid captures the close event.

       

       

      What I can't figure out for the life of me is how to refresh the datagrid's source data, when that source data is being called & populated from a "parent" component.

       

       

      How it works is like this...

       

       

      Search Component (6 drop down menus & 1 text input)

      |___Datagrid (displays all records by default, only records meeting search criteria upon clicking the "search" button)

        |______Popup window editor (this is called by passing the "ID" of the record I want to take action on into the popup window using a public variable when a user DOUBLE CLICKS a value in the datagrid)

       

       

      So let's say for instance you are looking at customer A.  Customer A's record loads into the popup window... and then let's say you want to delete that record for whatever reason.  Currently, when you click the "Delete Record" button in my application, the popup window closes, and from the looks of things, it dispatches the close event properly.  (I added an event listener to the datagrid component when I instantiated it in the search component), so when the popup window closes, the event listener fires and I have an Alert to tell me that yes, the close event was dispatched.

       

      I think I know "What" I'm doing wrong, but I don't know how to go about changing it to make it work.  Basically because the datagrid is populated IN the search component from an arraycollection, my attempts to "Refresh" the data in the datagrid component which captures the close event of the popup window won't work because the datagrid component has no visibility to the arraycollection used in the search component to populate said datagrid component.

       

      I know that the record is being deleted, as if I actually click the "search" button again, the record does disapear from the datagrid.  How do I force that to happen automagically when the popup form closes?

       

      I can provide a code refernce if I need to... gonna take a bit though as alot of what I've built has references to client's data which I'd have to remove.

       

      If anyone could provide some insight here, or a direction I would appreciate it.  I've looked at a number of solutions so far, and I've not had luck with any of them.