[flexcoders] Re: Datagrid with bound dataProvider not updating.
Thanks for all the responses! I took the advice and switched to using ArrayCollection and all is working fine now (without hammers :-)) Thanks again! --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: I think Alex called invalidateDisplayList a big hammer. The best solution to this is to never use Array, or XMLList for dynamic dataProviders, since their methods do not dispatch the necessary events to update the UI. Instead, wrap Array in ArrayCollection, and CMLList in XMLListCollection, or use XML directly. Tracy
[flexcoders] Re: Datagrid with bound dataProvider not updating.
Call refresh() on what? The dataGrid doesn't have a refresh() method. It is an Array rather than an ArrayCollection. Could that be the problem? This could require a lot of refactoring! Scratch all that... myDatagrid.invalidateDisplayList() did the trick! Thanks! --- In flexcoders@yahoogroups.com, Angus Johnson [EMAIL PROTECTED] wrote: arrayCollection or array? Try calling refresh() after the change. On 29/05/07, beecee1977 [EMAIL PROTECTED] wrote: Hi, I have a datagrid with the dataProvider bound to an array of objects. If I remove one of the items from the array the datagrid doesn't update to reflect this. Debugging and looking at the dataProvider's length it has updated, but that's not what's displayed. I've tried using validateNow() but that doesn't work. If I click on one of the column headers it updates. Currently I'm having to explicitly set the dataProvider in code, but then I lose the binding. Any suggestions? Thanks Bill
RE: [flexcoders] Re: Datagrid with bound dataProvider not updating.
We'll wrap the array in an ArrayCollection, so call dataGrid.dataProvider.refresh(). Or dataGrid.invalidateList() However, neither approach may work until you refactor to modify the ArrayCollection and not the array. Arrays do not have change notifications so we can't see what is changing. ArrayCollection does. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of beecee1977 Sent: Tuesday, May 29, 2007 3:51 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Datagrid with bound dataProvider not updating. Call refresh() on what? The dataGrid doesn't have a refresh() method. It is an Array rather than an ArrayCollection. Could that be the problem? This could require a lot of refactoring! Scratch all that... myDatagrid.invalidateDisplayList() did the trick! Thanks! --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Angus Johnson [EMAIL PROTECTED] wrote: arrayCollection or array? Try calling refresh() after the change. On 29/05/07, beecee1977 [EMAIL PROTECTED] wrote: Hi, I have a datagrid with the dataProvider bound to an array of objects. If I remove one of the items from the array the datagrid doesn't update to reflect this. Debugging and looking at the dataProvider's length it has updated, but that's not what's displayed. I've tried using validateNow() but that doesn't work. If I click on one of the column headers it updates. Currently I'm having to explicitly set the dataProvider in code, but then I lose the binding. Any suggestions? Thanks Bill
RE: [flexcoders] Re: Datagrid with bound dataProvider not updating.
I think Alex called invalidateDisplayList a big hammer. The best solution to this is to never use Array, or XMLList for dynamic dataProviders, since their methods do not dispatch the necessary events to update the UI. Instead, wrap Array in ArrayCollection, and CMLList in XMLListCollection, or use XML directly. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of beecee1977 Sent: Tuesday, May 29, 2007 6:51 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Datagrid with bound dataProvider not updating. Call refresh() on what? The dataGrid doesn't have a refresh() method. It is an Array rather than an ArrayCollection. Could that be the problem? This could require a lot of refactoring! Scratch all that... myDatagrid.invalidateDisplayList() did the trick! Thanks! --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Angus Johnson [EMAIL PROTECTED] wrote: arrayCollection or array? Try calling refresh() after the change. On 29/05/07, beecee1977 [EMAIL PROTECTED] wrote: Hi, I have a datagrid with the dataProvider bound to an array of objects. If I remove one of the items from the array the datagrid doesn't update to reflect this. Debugging and looking at the dataProvider's length it has updated, but that's not what's displayed. I've tried using validateNow() but that doesn't work. If I click on one of the column headers it updates. Currently I'm having to explicitly set the dataProvider in code, but then I lose the binding. Any suggestions? Thanks Bill