[flexcoders] Re: List item selection with filterFunction

2007-03-20 Thread ben.clinkinbeard
I experienced this when checking a CheckBox itemRenderer inside a
DataGrid a few motnhs back. I thought I had determined that it was a
change in the underlying dataProvider that caused the problem, but if
you're experiencing it just selecting an entire list item that sounds
different (but obviously related). I did have some trouble reproducing
this bug consistently.

I reported this to our support contact at Adobe but last I heard the
engineers were unable to reproduce it. He suspected it might be a bug
that was introduced in 2.0.1. Is that the version you're using?

There is a fairly painless workaround. In my case, just before
updating the item in the dataProvider, I would set the filterFunction
to null, then update the value, then reassign the filterFunction. You
don't need to call refresh() (I am assuming your dp is an
ArrayCollection), so the list won't unsort and resort or anything like
that. Sample code below:

var ff:Function = myAC.filterFunction;
myAC.filterFunction = null;
myAC.getItemAt(someIndex).someValue = newValue;
myAC.filterFunction = ff;

HTH,
Ben


--- In flexcoders@yahoogroups.com, Frank Sommers [EMAIL PROTECTED] wrote:

 I have a List, and when a filter function is assigned to that list,  
 whenever a selection is made (by clicking on a list item), the list  
 items re-arrange in a strange way. I wonder why this is happening.  
 When I remove the filter function, this does not occur. Any  
 suggestions would be appreciated.
 
 Thanks,
 
 -- Frank





[flexcoders] Re: List item selection with filterFunction

2007-03-20 Thread frank_sommers
Thanks for the suggestion. 

In my case, I don't change the underlying data provider, though  - I simply 
have an 
ArrayCollection set as the data provider for a List. When the filter function 
is set, the right 
thing happens: Only items in the list matching the filter criteria show. 
However, when at 
that point I click on a list item, the selected item sometimes jumps, so to 
speak, to a 
position above where it originally was, and other items rearrange in the list. 
I don't have a 
sort function set for the ArrayCollection, btw. 

I also noticed that this does not occur when the subset created with the filter 
function is 
small, i..e, 4-5 items or less. But when the subset is bigger (a dozen or more 
items), this 
occurs every time. And when the subset is very long (few dozen items), this 
makes the list 
unusable, as users cannot reliably select list items. 

I also verified this with a list that has no custom item renderer, btw. 

Yes, I'm using 2.0.1. 

Thanks, 

-- Frank


--- In flexcoders@yahoogroups.com, ben.clinkinbeard [EMAIL PROTECTED] wrote:

 I experienced this when checking a CheckBox itemRenderer inside a
 DataGrid a few motnhs back. I thought I had determined that it was a
 change in the underlying dataProvider that caused the problem, but if
 you're experiencing it just selecting an entire list item that sounds
 different (but obviously related). I did have some trouble reproducing
 this bug consistently.
 
 I reported this to our support contact at Adobe but last I heard the
 engineers were unable to reproduce it. He suspected it might be a bug
 that was introduced in 2.0.1. Is that the version you're using?
 
 There is a fairly painless workaround. In my case, just before
 updating the item in the dataProvider, I would set the filterFunction
 to null, then update the value, then reassign the filterFunction. You
 don't need to call refresh() (I am assuming your dp is an
 ArrayCollection), so the list won't unsort and resort or anything like
 that. Sample code below:
 
 var ff:Function = myAC.filterFunction;
 myAC.filterFunction = null;
 myAC.getItemAt(someIndex).someValue = newValue;
 myAC.filterFunction = ff;
 
 HTH,
 Ben