English 中文(简体)
Using one data source for multiple datagrids in Flex3
原标题:

I want to use one data source (e.g. an Array) for multiple Datagrids that have different filterFunctions attached and show different columns. First, I thought I use a very straight forward apporach:

  • create the Array
  • create an ArrayCollection for every DataGrid and set the "source" property to the Array
  • create the DataGrids and set their dataProvider property to its designated ArrayCollection

So now. every ArrayCollection can have its own filterFunction, sort state etc. but there needs to be only one Array with all the data in memory.

Now to the point that totally confused me: As new items are added to the Array, of course no Events are dispatched and I have to call itemUpdated manually on each of the ArrayCollections. While debugging into the code in order to get a deeper understanding for Flex, I tried to figure out, what this misterious "itemUpdated" method does, especially as it notes in the adobe documentation, that, if no "property" is given (e.g. it is null), a simple "refresh()" will occur. I did not find any calls to "refresh()" in the whole debugging (and I went down the framework whole as deep as possible (btw: lots of funny comments right in the code :-) )). The only thing I could find was a CollectionChangeEvent getting dispatched with a PropertyChangeEvent in its "item" property. Which was of the kind "UPDATE" (and not, as I would expect "ADD"). When trying to dispatch that event manually, it never worked (e.g. the datagrid did not update). I know I have to stick with itemUpdated for the moment, but as the dataprovider can get big (in both dimensions), performance does concern me and I wnat to understand what is going on under the hood.

And as expected, no help from adobe :-(

So a big thanks for everyone who read this whole text. And an even bigger THANKS to anyone who answers and gives me the slightes hint in how I can get out of the confusion and understand (if thats possible at all) Fles a little better.

finest of all regards,

herbert

最佳回答

You have to call ArrayCollection.refresh() for each of your dataProviders to get the dataGrids to show the new changes to the source array.

问题回答

暂无回答




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签