Yup, that's unique.   If you're good with the debugger, break on
mouseEventToItemRenderer in ListBase and see what's going on.

 

I guess I'd want to see how you filter, assign the dataprovider to the
DG, and steps to repro.  Are you filtering after or before the data is
assigned?

 

If this is a public app, you can tell us how to see the problem.

 

If you can wrap this up with your four objects in a mini-example, that
would be good too.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of simonjpalmer
Sent: Monday, September 17, 2007 7:31 AM
To: [email protected]
Subject: [flexcoders] Re: datagrid selection issues when bound to a
ListCollectionView

 

OK, middle of a release, so struggling to get round to this.

What I did was add code under a click even which cycles through the
dataProvider on the DataGrid in question and traces out the uids. I
put 4 known objects in the underlying list as a test and here is what
my console trace looked like...

7AC40327-B485-456C-CD39-044764F845FA
35E82259-FC56-9C3D-B623-04478EF6F548
DACEC13C-60C2-3D71-2468-0447BB55495A
D842C13C-5EB8-CA8F-7BAE-0447E255ED73

As you can see they are unique. The selection problem persists.

Something very weird is happening. If I bind to the underlying
ArrayCollection the selection problem goes away, but of course I lose
my filtering.

I'm at a bit of a loss. I was hoping that I could report that there
was some duplication of UIDs, but there isn't. I'm having to release
with this as a known bug because I cannot delay, which is pretty bad
for me.

I'd really appreciate any insights yo might have and I can hapily
share the rest of my code if it might help.

Simon

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> If the objects do not implement IUID and are not Managed, they get a
UID
> generated for them. Non-unique UIDs is the number 1 reason for
> selection problems. Everything you are doing looks fine, but we need
to
> eliminate or identify that possibility. Walk datagrid.dataProvider.
> That ensures you are examining the same set of objects the dg is.
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of simonjpalmer
> Sent: Thursday, September 13, 2007 9:12 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: datagrid selection issues when bound to a
> ListCollectionView
> 
> 
> 
> Sorry for the confusion, I meant I use the same filtering technique
> elsewhere but on Managed objects, which I explicitly refer to via
> their uid fields.
> 
> Are you suggesting I cycle through the objects in the
> ListCollectionView or the ArrayCollection?
> 
> I can try what you suggested on both, but I can be pretty certain that
> I am not adding duplicate objects to the base ArrayCollection on which
> the ListCollectionView operates because every one of them is created
> with the new operator.
> 
> Is a uid assigned to objects in the background by the framework?
> 
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > You confused me with this statements:
> > 
> > 
> > 
> > "I do this elsewhere but the objects in question are managed and I
use
> > the uids."
> > 
> > 
> > 
> > I thought you were wrapping the managed objects, but now I'm not
sure.
> > I guess the simplest test for you is, when you have selection
> problems,
> > to walk the collection and dump the results of UIDUtil.getUID() on
> each
> > object. If two are the same, you'll definitely have selection
problems
> > and then we need to figure out why that happened.
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of simonjpalmer
> > Sent: Thursday, September 13, 2007 8:54 AM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Re: datagrid selection issues when bound to a
> > ListCollectionView
> > 
> > 
> > 
> > The objects in the base ArrayCollection are custom objects in my
> > project. I create them with the new operator. Is that what you mean?
> > 
> > I do not explcitly handle the uid on these objects and they are not
> > Managed.
> > 
> > There is a subclass hierarchy in the objects, here are the class
> > declarations...
> > 
> > public class SuperAssumption extends SuperNote
> > 
> > public class SuperNote
> > 
> > The SuperNote holds a reference to an object in my domain model and
> > the internals of the SuperAssumption and SuperNote are hidden behind
> > getters which pick properties off the domain object. Neither of the
> > super* object has an explicitly declared uid, but the domain object
> > does. 
> > 
> > The creation code looks like this...
> > 
> > sass = new SuperAssumption(domainObject);
> > 
> > and is added to the ArrayCollection like this...
> > 
> > _assumptions.addItem(sass); 
> > 
> > I do this elsewhere but the objects in question are managed and I
use
> > the uids.
> > 
> > Does this make it clearer what I am doing?
> > 
> > Simon
> > 
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > , "Alex Harui" <aharui@> wrote:
> > >
> > > This usually implies that there are objects in there that have the
> > same
> > > UID. What do the objects look like and how are they generated and
> > > updated.
> > > 
> > > 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > ] On
> > > Behalf Of simonjpalmer
> > > Sent: Thursday, September 13, 2007 8:11 AM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com> 
> > > Subject: [flexcoders] datagrid selection issues when bound to a
> > > ListCollectionView
> > > 
> > > 
> > > 
> > > I have a UI which has a collection of filter definitions via
lists,
> an
> > > ArrayCollection of objects to be filtered, a ListCollectionView
> bound
> > > to the ArrayCollection and a filter function which consumes the
> lists
> > > and applies the appropriate filter to the objects. I then have a
> > > datagrid which displays the filtered list of objects by binding to
> the
> > > ListCollectionView.
> > > 
> > > The filtering works fine and as expected, and the
ListCollectionView
> > > and filter funciton is a very neat way to provide the filtered
list
> > > with arbitrarily complex filter criteria.
> > > 
> > > However, once the list is filtered I get very strange behaviour in
> the
> > > selection of items in the datagrid. I have multiple selection
> enabled
> > > on my datagrid and double-click so I can hop to a dialog to edit
the
> > > object.
> > > 
> > > Often when I click a completely different row gets selected. Just
as
> > > often the very last row in the grid is selected. Quite often
nothing
> > > at all gets selected. The clicks and double-clicks get fired but
> > > there is nothing in the selectedItem variable on the grid.
> > > 
> > > I'm not doing the object selection myself, I am leaving it up to
the
> > > datagrid to handle it, so I cannot blame bad indexing on my end,
it
> > > just doesn't seem to work properly.
> > > 
> > > I'm using FlexBuilder 2.
> > > 
> > > Anyone encountered anything like this? I am hoping it is not a
bug.
> > >
> >
>

 

Reply via email to