0 Replies Latest reply on Dec 12, 2011 9:40 PM by Corey Osman

    filter list no longer works correctly in 4.6

    Corey Osman

      I have been using the classic filter function for array collections since 4.0.  With the recent 4.6 update my filter no longer works correctly.

       

      Example of classic realtime filter:

       

      http://experiments.mrinalwadhwa.com/FilterFunctions/srcview/index.html

       

       

      While the filter works and updates the list just like it used to, the underlying arraycollection doesn't get updated.

       

      For example:

       

      Pretend I have the following AC

      testData = new ArrayCollection([

                              {name:"Item 1", price:18},

                              {name:"Item 2", price:50},

                              {name:"Item 3", price:77},

                              {name:"Item 4", price:52},

                              {name:"Item 5", price:43},

                              {name:"Item 6", price:97},

                              {name:"Item 7", price:56},

                              {name:"Item 8", price:81},

                              {name:"Item 9", price:63},

                              {name:"Item 10", price:29},

                              {name:"Item 11", price:84},

                              {name:"Item 12", price:31},

                              {name:"Item 13", price:78},

                              {name:"Item 14", price:48},

                              {name:"Item 15", price:23},

                          ]);

       

       

      1. I start typing 9 in a textbox to filter the list

      2. list filters down to what I want

      3. I click on the item in the list which fires off the IndexChangeEvent

      4. changeHandler is called

       

      protected function changeHandler(event:IndexChangeEvent):void

      {

             filterTxt.text = "";

             this.saveScrollPosition();

             var selfact:Object = event.currentTarget.selectedIndex;

       

           // This should yield 8, however because testdata current view only has one item in the list the event.newIndex is acutally 0 where it should be 8

           // So I would need a way to get to the "current view"

      }

       

      So its like there are two lists.

       

      1. filteredlist (auto generated) 

      2. list with mydata before filter.

       

      The IndexChangeEvent is giving me the selectedindex of the filtered list (item 0) but resolving item 0 with the unfiltered list and the data does not match up.

      Now I can no longer get the correct name of the list after applying the fiilter.

       

      Is this a bug that was introduced in Flex 4.6?