7 Replies Latest reply on Apr 12, 2010 1:25 PM by Shongrunden

    Is this a <s:List bug?

    SpaghettiCoder Level 3

      Flash Builder 4

       

      If you have a

      <s:List

       

      layout as TileLayout, with a itemRenderer.

       

      click on a button it filters the AC.

       

      adds scroll bar because there are more objects then displayable.

       

      click on button it filters the AC.

       

      removes scroll bar because there are less objects then displayable.

       

      THIS IS WHERE IT GOES weird!

       

      click on a button it filters it.

       

      There are obviously more objects then displayable but the scroll bars don't get re-added !

       

      I have a label bound to the length of the AC to tell me how many are supposed to be showing up.

       

      Spent atleast a full day messing around with this.

        • 1. Re: Is this a <s:List bug?
          Shongrunden Adobe Employee

          Can you please post a small sample application that demonstrates this?

          • 2. Application source
            SpaghettiCoder Level 3

            <?xml version="1.0" encoding="utf-8"?>

            <s:Application

             

             

            xmlns:fx="http://ns.adobe.com/mxml/2009"

            xmlns:s="

            library://ns.adobe.com/flex/spark"

            xmlns:mx="

            library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="onCreationComplete()">

             

             

             

            <fx:Script>

            <![CDATA[

             

             

            import mx.collections.ArrayCollection;

             

            [

            Bindable]

             

            private var acTest:ArrayCollection

             

             

            private var tempArray:Array = [

            {city:

            'c1', state:'s1', whatever:'a'},

            {city:

            'c2', state:'s1', whatever:'a'},

            {city:

            'c3', state:'s1', whatever:'a'},

            {city:

            'c4', state:'s1', whatever:'a'},

            {city:

            'c5', state:'s1', whatever:'a'},

            {city:

            'c6', state:'s1', whatever:'a'},

            {city:

            'c7', state:'s1', whatever:'a'},

            {city:

            'c8', state:'s1', whatever:'a'},

            {city:

            'c9', state:'s1', whatever:'a'},

            {city:

            'c10', state:'s1', whatever:'a'},

            {city:

            'c11', state:'s2', whatever:'a'},

            {city:

            'c12', state:'s2', whatever:'a'}];

             

             

            private function onCreationComplete():void

            {

             

            var _acTest:ArrayCollection = new ArrayCollection(tempArray);

            acTest = _acTest

            }

             

             

             

             

            private var mySearchCriteria:String;

             

             

            private function s1Clicked():void

            {

            mySearchCriteria =

            "s1";

             

            acTest.filterFunction = myFilterFunction;

             

            acTest.refresh();

            }

             

             

            private function s2Clicked():void

            {

            mySearchCriteria =

            "s2";

             

            acTest.filterFunction = myFilterFunction;

             

            acTest.refresh();

            }

             

             

            private function myFilterFunction(obj:Object):Boolean

            {

             

            return (obj.state == mySearchCriteria);

            }

             

            ]]>

             

            </fx:Script>

             

             

            <s:List id="tlTest" dataProvider="{acTest}" visible="true" itemRenderer="renderers.tlAdsRenderer" width="70" height="452" x="64" y="10">

             

            <s:layout>

             

            <s:TileLayout/>

             

            </s:layout>

             

            </s:List>

             

             

            <s:Button x="9" y="519" label="filter S1" click="s1Clicked()"/>

             

            <s:Button x="113" y="519" label="filter S2" click="s2Clicked()"/>

             

            <s:Label x="23" y="486" text="RETURN : {acTest.length}"/>

            </s:Application>

            • 3. Item Renderer source
              SpaghettiCoder Level 3

              <?xml version="1.0" encoding="utf-8"?>

              <s:ItemRenderer

               

               

              xmlns:fx="http://ns.adobe.com/mxml/2009"

              xmlns:s="

              library://ns.adobe.com/flex/spark"

              xmlns:mx="

              library://ns.adobe.com/flex/mx"

              autoDrawBackground="

              true" width="42" height="62">

               

               

               

              <s:layout>

               

               

              <s:VerticalLayout paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5"/>

               

              </s:layout>

               

               

               

              <mx:Image source="pictures/{data.whatever}/0.jpg" width="40" height="60"/>

               

              </s:ItemRenderer>

              • 4. Re: Is this a <s:List bug?
                SpaghettiCoder Level 3

                data starts with 12,

                 

                click on s1 you'll get 10 and a scroll bar.

                 

                click on s2 you'll get 2 and scroll bar dissappears

                 

                click back on s1 you'll get 10 BUT it only shows 2, and scroll bar is missing.

                • 5. Re: Is this a <s:List bug?
                  Shongrunden Adobe Employee

                  Looks like a bug to me.  Here is a slightly reduced test case:

                   

                  <s:Application
                      xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark">
                      
                      <fx:Script>
                          <![CDATA[
                              private var mySearchCriteria:String;
                              
                              private function s1Clicked():void {
                                  mySearchCriteria = "s1";
                                  acTest.filterFunction = myFilterFunction;
                                  acTest.refresh();
                              }
                              
                              private function s2Clicked():void {
                                  mySearchCriteria = "s2";
                                  acTest.filterFunction = myFilterFunction;
                                  acTest.refresh();
                              }
                              
                              private function myFilterFunction(obj:Object):Boolean {
                                  return (obj.state == mySearchCriteria);
                              }
                          ]]>
                      </fx:Script>
                  
                      <s:HGroup>
                          <s:List id="tlTest" width="70" height="452">
                              <s:dataProvider>
                                  <s:ArrayCollection id="acTest">
                                      <fx:Object city="c1"  state="s1" whatever="a" />
                                      <fx:Object city="c2"  state="s1" whatever="a" />
                                      <fx:Object city="c3"  state="s1" whatever="a" />
                                      <fx:Object city="c4"  state="s1" whatever="a" />
                                      <fx:Object city="c5"  state="s1" whatever="a" />
                                      <fx:Object city="c6"  state="s1" whatever="a" />
                                      <fx:Object city="c7"  state="s1" whatever="a" />
                                      <fx:Object city="c8"  state="s1" whatever="a" />
                                      <fx:Object city="c9"  state="s1" whatever="a" />
                                      <fx:Object city="c10" state="s1" whatever="a" />
                                      <fx:Object city="c11" state="s2" whatever="a" />
                                      <fx:Object city="c12" state="s2" whatever="a" />
                                  </s:ArrayCollection>
                              </s:dataProvider>
                              <s:itemRenderer>
                                  <fx:Component>
                                      <s:ItemRenderer>
                                          <s:Button label="{data.city}" width="40" height="60" />
                                      </s:ItemRenderer>
                                  </fx:Component>
                              </s:itemRenderer>
                              <s:layout>
                                  <s:TileLayout />
                              </s:layout>
                          </s:List>
                      
                          <s:VGroup>
                              <s:Button label="filter S1" click="s1Clicked()"/>
                              <s:Button label="filter S2" click="s2Clicked()"/>
                              <s:Label text="dataProvider.length: {acTest.length}"/>
                          </s:VGroup>
                      </s:HGroup>
                  </s:Application>
                  

                   

                   

                  Could you please file a bug with this code at http://bugs.adobe.com  and post the bug number here?

                  • 6. Re: Is this a <s:List bug?
                    SpaghettiCoder Level 3

                    FB-26580

                    • 7. Re: Is this a <s:List bug?
                      Shongrunden Adobe Employee

                      Thanks.  I updated the link to be an SDK bug: http://bugs.adobe.com/jira/browse/SDK-26202