I think you should prepare and submit a patch for your bug. Personally, it seems odd that you’d want to break the contract of what “sort” means. I think if anything, you’d want to hide the “toArray and reset” flow and coalesce or block events the reset.
On 3/23/10 2:10 PM, "tntomek" <[email protected]> wrote: Hi Alex, Specific issues I've had were mostly in DMV components, GroupingCollection (and GC2), HierarchicalData and ADG all make hard coded "new SomeSdkFlexClass()" with no way to plug in a custom class' that implements the necessary interface. I already made my custom copies of GC since it's beyond hope to plug in a custom ICollectionView/IList. And because ADG instantiates HierarchicalData I had to monkey patch that as well. You're right in that I could do the toArray and reassign to my View but that would totally recreate the view in an undesirable way. It's a lot cleaner for me to have CustomAC and just inherit from AC and set enablePostSortReorder=false in CustomAC constructor. I never actually change the value of enablePostSortReorder once its instantiated and assigned to my view. I do however update sorts/group and filters without having to set my ADG to new dataProvider. To me this freezing of sort/filter state is no different then asking me to do a custom filter then reassign back to my view object, we just don't do that, its enough to call sort/filter/group and refresh() and this keeps that behavior consistent. And this is internal code and not something we are distributing, in that case I would of course not even consider monkey patch route. What do you think? Would this be a valid SDK candidate change? Here is the specific bug I filed a while back. https://bugs.adobe.com/jira/browse/FLEXDMV-2341 -Tomek (http://tomek.me) --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , Alex Harui <aha...@...> wrote: > > I'm confused. Whose code makes "new ArrayCollection" assumptions? > > The area of code you are changing implies that the collection has long since > been established, a sort or filter is applied and you want to make some > change that does that should not adjust the sort or filtered results. Under > what conditions is that happening? In many cases folks want to freeze the > current sort and then add new items at random. At the time they would set > your enablePostSortReorder=false, they can just as easily copy the AC into a > new one using toArray > > > On 3/23/10 12:17 AM, "tntomek" <tnto...@...> wrote: > > > > > > > Thanks Alex I'll give the order a shot. I'm not so much introducing a new api > as adding a bool to toggle some behavior, be default it will behave like > vanilla. > > The specific issue is to disable sort in ListCollectionView and since > ArrayCollection inherits from that and many controls are hard coded for "new > ArrayCollection" vs new Factory(SomeCollection) I don't see many options. > > Do you have time to give your 2 cents? > > In > private function handlePropertyChangeEvents(events:Array):void > > Change > > if (sort || filterFunction != null) > > to > > if (enablePostSortReorder && (sort || filterFunction != null)) > > http://tomek.me/disable-sort-on-datagrid-edit-update/ > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> , Alex Harui <aharui@> wrote: > > > > It is bad practice to be adding new APIs when monkey-patching. You should > > be subclassing instead. > > > > However, all that should matter is the compile time stamp in the SWC. > > Newest one wins. Make sure the SWCs are listed in the correct order just > > to be safe in your project properties. I'm not sure if code hints go > > lookin for the time stamps. > > > > > > On 3/22/10 5:30 PM, "tntomek" <tntomek@> wrote: > > > > > > > > > > > > > > Seems like monkey patching works when everything is included in 1 project > > but not when using libraries. What happens when I have 2 projects and > > monkey patch is in other one. > > > > i.e. > > MainAppProject (contains MainApp.mxml) > > -SomeLibraryProject (this has the monkey patch code, i.e. Button) > > > > Now in my MainApp.mxml I'm unable to reference my version of the code. > > > > I understand if I use RSLs I can force load my class first so runtime would > > work, but how do I get compile time access to this class? What if I added a > > new property (in library project) and I want to access that property from > > MainApp? The compiler has no idea and I can't build. This forces me to make > > the monkey patch class implement some interface that would guarantee > > compile time changes, but this is getting way more complicated then it > > needs to. Any other ideas? > > > > -Tom Gruszowski (http://tomek.me) > > > > > > > > > > > > > > -- > > Alex Harui > > Flex SDK Team > > Adobe System, Inc. > > http://blogs.adobe.com/aharui > > > > > > > > > -- > Alex Harui > Flex SDK Team > Adobe System, Inc. > http://blogs.adobe.com/aharui > -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui

